mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
fix: use a timer instead of a time.After to avoid memory leaks
This commit is contained in:
@@ -993,11 +993,13 @@ func (c *Command) terminateGracefully(signalCh chan os.Signal, sdSock io.Writer)
|
||||
close(gracefulCh)
|
||||
}()
|
||||
|
||||
delay := time.NewTimer(gracefulTimeout)
|
||||
|
||||
// Wait for leave or another signal
|
||||
select {
|
||||
case <-signalCh:
|
||||
return 1
|
||||
case <-time.After(gracefulTimeout):
|
||||
case <-delay.C:
|
||||
return 1
|
||||
case <-gracefulCh:
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user