зеркало из https://github.com/github/vitess-gh.git
support 'TickNow()'
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
This commit is contained in:
Родитель
a7dc1d0b58
Коммит
57de1c1b20
|
@ -61,6 +61,15 @@ func (s *SuspendableTicker) Stop() {
|
|||
s.ticker.Stop()
|
||||
}
|
||||
|
||||
// TickNow generates a tick at this point in time. It may block
|
||||
// if nothing consumes the tick.
|
||||
func (s *SuspendableTicker) TickNow() {
|
||||
if atomic.LoadInt64(&s.suspended) == 0 {
|
||||
// not suspended
|
||||
s.C <- time.Now()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SuspendableTicker) loop() {
|
||||
for t := range s.ticker.C {
|
||||
if atomic.LoadInt64(&s.suspended) == 0 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче