nil-ThrottleTimer.Stop() does nothing

This commit is contained in:
Jae Kwon
2015-07-20 17:26:22 -07:00
parent 3a9b465c75
commit f51cfc03ea
2 changed files with 7 additions and 2 deletions

View File

@@ -46,7 +46,12 @@ func (t *ThrottleTimer) Set() {
}
}
// For ease of .Stop()'ing services before .Start()'ing them,
// we ignore .Stop()'s on nil ThrottleTimers
func (t *ThrottleTimer) Stop() bool {
if t == nil {
return false
}
close(t.quit)
return t.timer.Stop()
}