Merge pull request #12565 from rainzm/automated-cherry-pick-of-#12564-upstream-release-3.8

Automated cherry pick of #12564: fix(region): init timerQueue correctly
This commit is contained in:
Zexi Li
2021-11-01 10:05:53 +08:00
committed by GitHub

View File

@@ -571,9 +571,12 @@ func (stm *SScheduledTaskManager) timeScope(median time.Time, interval time.Dura
}
}
var timerQueue = make(chan struct{}, cop.Options.ScheduledTaskQueueSize)
var timerQueue chan struct{}
func (stm *SScheduledTaskManager) Timer(ctx context.Context, userCred mcclient.TokenCredential, isStart bool) {
if timerQueue == nil {
timerQueue = make(chan struct{}, cop.Options.ScheduledTaskQueueSize)
}
// 60 is for fault tolerance
interval := 60 + 30
timeScope := stm.timeScope(time.Now(), time.Duration(interval)*time.Second)