mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
internal/test/daemon: don't leak timers
A timer is leaking on every daemon start and stop. Probably nothing major, but given the amount of daemon starts/stops during tests, it's better to be accurate about it. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
73baee2dcf
commit
6016520162
1 changed files with 7 additions and 2 deletions
|
@ -285,7 +285,10 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
||||||
|
|
||||||
d.Wait = wait
|
d.Wait = wait
|
||||||
|
|
||||||
tick := time.Tick(500 * time.Millisecond)
|
ticker := time.NewTicker(500 * time.Millisecond)
|
||||||
|
defer ticker.Stop()
|
||||||
|
tick := ticker.C
|
||||||
|
|
||||||
// make sure daemon is ready to receive requests
|
// make sure daemon is ready to receive requests
|
||||||
startTime := time.Now().Unix()
|
startTime := time.Now().Unix()
|
||||||
for {
|
for {
|
||||||
|
@ -423,7 +426,9 @@ func (d *Daemon) StopWithError() error {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
i := 1
|
i := 1
|
||||||
tick := time.Tick(time.Second)
|
ticker := time.NewTicker(time.Second)
|
||||||
|
defer ticker.Stop()
|
||||||
|
tick := ticker.C
|
||||||
|
|
||||||
if err := d.cmd.Process.Signal(os.Interrupt); err != nil {
|
if err := d.cmd.Process.Signal(os.Interrupt); err != nil {
|
||||||
if strings.Contains(err.Error(), "os: process already finished") {
|
if strings.Contains(err.Error(), "os: process already finished") {
|
||||||
|
|
Loading…
Add table
Reference in a new issue