mirror of
https://github.com/Luzifer/streamdeck.git
synced 2024-12-20 17:51:21 +00:00
Prevent system crash by too fast executions
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
ecdf4967ae
commit
a8ce516a64
2 changed files with 15 additions and 2 deletions
|
@ -114,7 +114,14 @@ func (d displayElementExec) Display(ctx context.Context, idx int, attributes att
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d displayElementExec) NeedsLoop(attributes attributeCollection) bool {
|
func (d displayElementExec) NeedsLoop(attributes attributeCollection) bool {
|
||||||
return attributes.Interval > 0
|
if attributes.Interval > 0 && attributes.Interval < 100*time.Millisecond {
|
||||||
|
log.WithFields(log.Fields{
|
||||||
|
"tpye": "exec",
|
||||||
|
"interval": attributes.Interval,
|
||||||
|
}).Warn("Ignoring interval below 100ms")
|
||||||
|
}
|
||||||
|
|
||||||
|
return attributes.Interval > 100*time.Millisecond
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *displayElementExec) StartLoopDisplay(ctx context.Context, idx int, attributes attributeCollection) error {
|
func (d *displayElementExec) StartLoopDisplay(ctx context.Context, idx int, attributes attributeCollection) error {
|
||||||
|
|
|
@ -118,8 +118,14 @@ func (d displayElementPulseVolume) NeedsLoop(attributes attributeCollection) boo
|
||||||
|
|
||||||
func (d *displayElementPulseVolume) StartLoopDisplay(ctx context.Context, idx int, attributes attributeCollection) error {
|
func (d *displayElementPulseVolume) StartLoopDisplay(ctx context.Context, idx int, attributes attributeCollection) error {
|
||||||
interval := time.Second
|
interval := time.Second
|
||||||
if attributes.Interval > 0 {
|
if attributes.Interval > 100*time.Millisecond {
|
||||||
interval = attributes.Interval
|
interval = attributes.Interval
|
||||||
|
} else if attributes.Interval > 0 {
|
||||||
|
log.WithFields(log.Fields{
|
||||||
|
"tpye": "pulsevolume",
|
||||||
|
"idx": idx,
|
||||||
|
"interval": attributes.Interval,
|
||||||
|
}).Warn("Ignoring interval below 100ms")
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
|
Loading…
Reference in a new issue