use $MAIN_INTERVAL_DURATION
parent
5edefdff5f
commit
594bc39470
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 {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
w: 20
|
||||||
|
a: 10
|
||||||
|
s: 5
|
||||||
|
d: 40
|
||||||
Loading…
Reference in New Issue