mirror of
https://github.com/kidoman/embd
synced 2024-12-22 04:40:04 +01:00
moving ticker.Stop to defer statement when creating ticker
This commit is contained in:
parent
333194b96f
commit
3574e65c8d
@ -74,6 +74,7 @@ func main() {
|
||||
|
||||
// Start main loop
|
||||
ticker := time.NewTicker(time.Duration(*stepDelay) * time.Millisecond)
|
||||
defer ticker.Stop()
|
||||
|
||||
var stepCounter int
|
||||
for {
|
||||
@ -102,7 +103,6 @@ func main() {
|
||||
}
|
||||
|
||||
case <-quit:
|
||||
ticker.Stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user