fix(region): init timerQueue correctly

This commit is contained in:
rainzm
2021-10-30 18:01:57 +08:00
parent 91996c7871
commit 0bb2ee63d7
+4 -1
View File
@@ -576,9 +576,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)