Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blackroot committed Mar 18, 2022
1 parent a55eddd commit 7c7c1a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xdelay_queue/delay_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,18 @@ func (dq *DelayQueue) UpdateJob(jobCore *JobCore) error {
}
}
var (
jobId string
bucketName string
bucketIdx int
doneTimes int64
)
if job == nil {
jobId = jobCore.Id
jobBucket := <-dq.bucketNameChan
bucketName = jobBucket.BucketName
bucketIdx = jobBucket.BucketIndex
} else {
jobId = job.Id
bucketName = job.BucketName
bucketIdx = job.BucketIndex
doneTimes = job.DoneTimes
Expand All @@ -161,7 +164,7 @@ func (dq *DelayQueue) UpdateJob(jobCore *JobCore) error {
return redis.NewScript(`
redis.call("SET", KEYS[1], ARGV[1])
redis.call("ZADD", KEYS[2], ARGV[2], ARGV[3])
`).Run(dq.Client, []string{job.Id, job.BucketName}, value, float64(jobCore.Delay), job.Id).Err()
`).Run(dq.Client, []string{jobId, bucketName}, value, float64(jobCore.Delay), jobId).Err()
}

func (dq *DelayQueue) BatchAddJob(jobCores []*JobCore) error {
Expand Down

0 comments on commit 7c7c1a8

Please sign in to comment.