优化
This commit is contained in:
+1
-5
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user