use $MAIN_INTERVAL_DURATION
This commit is contained in:
10
src/main.go
10
src/main.go
@@ -5,13 +5,21 @@ import (
|
|||||||
"mayhem-party/src/device/input"
|
"mayhem-party/src/device/input"
|
||||||
"mayhem-party/src/device/output"
|
"mayhem-party/src/device/output"
|
||||||
"mayhem-party/src/device/output/key"
|
"mayhem-party/src/device/output/key"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Main(ctx context.Context) error {
|
func Main(ctx context.Context) error {
|
||||||
reader := input.New()
|
reader := input.New()
|
||||||
writer := output.New()
|
writer := output.New()
|
||||||
c := time.NewTicker(time.Millisecond * 50)
|
interval := time.Millisecond * 50
|
||||||
|
if intervalS, ok := os.LookupEnv("MAIN_INTERVAL_DURATION"); !ok {
|
||||||
|
} else if v, err := time.ParseDuration(intervalS); err != nil {
|
||||||
|
panic(err)
|
||||||
|
} else {
|
||||||
|
interval = v
|
||||||
|
}
|
||||||
|
c := time.NewTicker(interval)
|
||||||
defer c.Stop()
|
defer c.Stop()
|
||||||
|
|
||||||
block := func() bool {
|
block := func() bool {
|
||||||
|
|||||||
4
testdata/INPUT_RANDOM_WEIGHT_FILE.yaml
vendored
Normal file
4
testdata/INPUT_RANDOM_WEIGHT_FILE.yaml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
w: 20
|
||||||
|
a: 10
|
||||||
|
s: 5
|
||||||
|
d: 40
|
||||||
Reference in New Issue
Block a user