mirror of
https://github.com/Luzifer/streamdeck.git
synced 2024-12-20 17:51:21 +00:00
Load display elements async, only fail current key on error
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
8e3a5d6ed1
commit
656a4710f0
1 changed files with 13 additions and 5 deletions
|
@ -229,12 +229,20 @@ func togglePage(page string) error {
|
|||
activePageCtx, activePageCtxCancel = context.WithCancel(context.Background())
|
||||
sd.ClearAllKeys()
|
||||
|
||||
for idx, kd := range activePage.Keys {
|
||||
if kd.Display.Type != "" {
|
||||
if err := callDisplayElement(activePageCtx, idx, kd); err != nil {
|
||||
return errors.Wrapf(err, "Unable to execute display element on key %d", idx)
|
||||
}
|
||||
for idx := range activePage.Keys {
|
||||
if activePage.Keys[idx].Display.Type == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
go func(idx int) {
|
||||
var kd = activePage.Keys[idx]
|
||||
if err := callDisplayElement(activePageCtx, idx, kd); err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"key": idx,
|
||||
"page": activePageName,
|
||||
}).WithError(err).Error("Unable to execute display element")
|
||||
}
|
||||
}(idx)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue