|
|
@ -26,7 +26,9 @@ func NewThrottleTimer(name string, dur time.Duration) *ThrottleTimer { |
|
|
|
var ch = make(chan struct{}) |
|
|
|
var quit = make(chan struct{}) |
|
|
|
var t = &ThrottleTimer{Name: name, Ch: ch, dur: dur, quit: quit} |
|
|
|
t.mtx.Lock() |
|
|
|
t.timer = time.AfterFunc(dur, t.fireRoutine) |
|
|
|
t.mtx.Unlock() |
|
|
|
t.timer.Stop() |
|
|
|
return t |
|
|
|
} |
|
|
|