Skip to content

Commit 451f11b

Browse files
authored
Update corntask.go
fix bug
1 parent d514057 commit 451f11b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/corntask/corntask.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func (t *Timer) init() {
6464

6565
t.remoteQueueAssign()
6666

67+
if localQueueExecutorNum <= 0 {
68+
localQueueExecutorNum = 1
69+
}
70+
6771
localQueueExecutorNum := len(t.assignedRemoteQueueKeys) * 10
6872
if localQueueExecutorNum > 500 {
6973
localQueueExecutorNum = 500
@@ -118,8 +122,7 @@ func (t *Timer) clientHeartbeat() {
118122
}
119123

120124
func (t *Timer) stopClientHeartbeat() {
121-
err := t.redisClient.ZRem(context.Background(), t.getClientKey(),
122-
redis.Z{Score: float64(time.Now().Unix()), Member: t.clientID}).Err()
125+
err := this.redisClient.ZRem(context.Background(), this.getClientKey(), t.clientID).Err()
123126
if err != nil {
124127
t.log.Errorf("timer=Stop, RemoteQueueKey=%s, err=%v", t.remoteQueueKey, err)
125128
return

0 commit comments

Comments
 (0)