From 7436df9b99cb4fec3bb24f2c7c5bceb159fb7bf1 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Mon, 27 Jul 2015 15:31:39 -0700 Subject: [PATCH] nomad: fixing plan queue dequeue with no timeout --- nomad/plan_queue.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nomad/plan_queue.go b/nomad/plan_queue.go index 601bb1574..ab2426bf0 100644 --- a/nomad/plan_queue.go +++ b/nomad/plan_queue.go @@ -135,17 +135,18 @@ SCAN: q.l.Unlock() // Setup the timeout timer - var timer *time.Timer - if timer == nil && timeout > 0 { - timer = time.NewTimer(timeout) + var timerCh <-chan time.Time + if timerCh == nil && timeout > 0 { + timer := time.NewTimer(timeout) defer timer.Stop() + timerCh = timer.C } // Wait for timeout or new work select { case <-q.waitCh: goto SCAN - case <-timer.C: + case <-timerCh: return nil, nil } }