update wait logic

This commit is contained in:
Darien Raymond
2017-01-31 14:15:34 +01:00
parent 23a8da215f
commit 52ee3ff79c
+8 -11
View File
@@ -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
}
}
}