mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-24 16:05:00 +08:00
Replace time.After with time.NewTimer (#12945)
time.After might leave stray timers if other channels in select triggered early Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
This commit is contained in:
committed by
Claudio Costa
parent
a3257690d6
commit
9b9923ea42
+4
-1
@@ -86,11 +86,13 @@ func (schedulers *Schedulers) Start() *Schedulers {
|
||||
}
|
||||
|
||||
for {
|
||||
timer := time.NewTimer(1 * time.Minute)
|
||||
select {
|
||||
case <-schedulers.stop:
|
||||
mlog.Debug("Schedulers received stop signal.")
|
||||
timer.Stop()
|
||||
return
|
||||
case now = <-time.After(1 * time.Minute):
|
||||
case now = <-timer.C:
|
||||
cfg := schedulers.jobs.Config()
|
||||
|
||||
for idx, nextTime := range schedulers.nextRunTimes {
|
||||
@@ -128,6 +130,7 @@ func (schedulers *Schedulers) Start() *Schedulers {
|
||||
}
|
||||
}
|
||||
}
|
||||
timer.Stop()
|
||||
}
|
||||
})
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user