From 1fc6d71db6e2615c9f8cd8329c47cd5fddb772f0 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 23 Mar 2023 17:00:49 -0600 Subject: [PATCH] $INPUT_BUFFERED_STICKY_DURATION --- src/device/input/buffered.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/device/input/buffered.go b/src/device/input/buffered.go index c1416f1..6ad5bda 100644 --- a/src/device/input/buffered.go +++ b/src/device/input/buffered.go @@ -2,6 +2,7 @@ package input import ( "context" + "os" "sync" "time" ) @@ -18,14 +19,18 @@ type Buffered struct { func NewBuffered(ctx context.Context, input Input) *Buffered { ctx, can := context.WithCancel(ctx) + expirationInterval := time.Millisecond * 125 + if d, err := time.ParseDuration(os.Getenv("INPUT_BUFFERED_STICKY_DURATION")); err == nil { + expirationInterval = d + } result := &Buffered{ input: input, ctx: ctx, can: can, lock: sync.Mutex{}, keys: map[byte]int64{}, - listenInterval: time.Millisecond * 20, - expirationInterval: time.Millisecond * 100, + listenInterval: time.Millisecond * 10, + expirationInterval: expirationInterval, } go result.listen() return result