修改任务没有执行的问题

This commit is contained in:
Yun
2025-10-14 12:07:31 +08:00
parent de3568de42
commit 49f9e8bde6
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -121,8 +121,8 @@ func InitOnce(ctx context.Context, re redis.UniversalClient, keyPrefix string, c
keySeparator: "[:]",
timeout: op.timeout,
maxRunCount: op.maxRunCount,
workerChan: make(chan struct{}, op.maxRunCount),
maxWorkers: op.maxRunCount,
workerChan: make(chan struct{}, op.maxWorkers),
maxWorkers: op.maxWorkers,
}
// 初始化优先级
@@ -289,7 +289,8 @@ func (l *Once) executeTasks() {
return
case <-l.ctx.Done():
return
case <-l.workerChan:
case l.workerChan <- struct{}{}:
keys, err := l.redis.BLPop(l.ctx, time.Second*10, l.listKey).Result()
if err != nil {
if err != redis.Nil {