This commit is contained in:
Yun
2023-09-03 00:30:22 +08:00
parent 5f3193d95e
commit 1cc64264f7
3 changed files with 18 additions and 15 deletions
+1 -5
View File
@@ -82,7 +82,6 @@ func (c *cluster) AddTimer(ctx context.Context, uniqueKey string, spaceTime time
return errors.New("添加失败")
}
defer lock.Unlock()
lock.Refresh()
nowTime := time.Now()
@@ -135,9 +134,6 @@ func (c *cluster) getNextTime() {
}
defer lock.Unlock()
// 更新锁
lock.Refresh()
// 计算下一次时间
// 读取执行的缓存
@@ -254,6 +250,7 @@ func doTask(ctx context.Context, red *redis.Client, taskId string) {
val, ok := clusterWorkerList.Load(taskId)
if !ok {
fmt.Println("doTask timer:任务不存在")
return
}
t := val.(timerStr)
@@ -266,7 +263,6 @@ func doTask(ctx context.Context, red *redis.Client, taskId string) {
return
}
defer lock.Unlock()
lock.Refresh()
ctx = context.WithValue(ctx, extendParamKey, t.Extend)