From 52ee3ff79c5126f804ec4aaa1da696723aaacba2 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 31 Jan 2017 14:15:34 +0100 Subject: [PATCH] update wait logic --- common/signal/timer.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/common/signal/timer.go b/common/signal/timer.go index 0eb92d2ab..dfcbd849a 100644 --- a/common/signal/timer.go +++ b/common/signal/timer.go @@ -23,20 +23,17 @@ func (t *ActivityTimer) run() { for { select { case <-time.After(t.timeout): - t.cancel() - return case <-t.ctx.Done(): return - default: - select { - case <-time.After(t.timeout): - t.cancel() - return - case <-t.ctx.Done(): - return - case <-t.updated: - } } + select { + case <-t.updated: + // Updated keep waiting. + default: + t.cancel() + return + } + } }