fix(region): init timerQueue correctly

This commit is contained in:
rainzm
2021-10-30 17:59:30 +08:00
parent df82bd1cb9
commit 76ff9de58b
+4 -1
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)