This commit is contained in:
Yun
2023-09-09 15:42:13 +08:00
parent 1cc64264f7
commit 3200f19d63
2 changed files with 5 additions and 6 deletions
+3 -5
View File
@@ -230,9 +230,7 @@ func (c *cluster) watch() {
fmt.Println("watch err:", err)
continue
}
for _, val := range keys {
go doTask(c.ctx, c.redis, val)
}
go doTask(c.ctx, c.redis, keys[1])
}
}
@@ -250,7 +248,7 @@ func doTask(ctx context.Context, red *redis.Client, taskId string) {
val, ok := clusterWorkerList.Load(taskId)
if !ok {
fmt.Println("doTask timer:任务不存在")
fmt.Println("doTask timer:任务不存在", taskId)
return
}
t := val.(timerStr)
@@ -259,7 +257,7 @@ func doTask(ctx context.Context, red *redis.Client, taskId string) {
lock := lockx.NewGlobalLock(ctx, red, taskId)
tB := lock.Lock()
if !tB {
fmt.Println("doTask timer:获取锁失败")
fmt.Println("doTask timer:获取锁失败", taskId)
return
}
defer lock.Unlock()
+1
View File
@@ -94,6 +94,7 @@ func aa(ctx context.Context) bool {
// fmt.Println("gggggggggggggggggggggggggggg")
a, err := timer.GetExtendParams(ctx)
fmt.Printf("%+v %+v \n\n", a, err)
time.Sleep(time.Second*5)
return true
}