[GH-ISSUE #1076] [BUG] archiveCmd use BYSCORE which is not supported by redis 4 #1526

Closed
opened 2026-03-07 22:10:59 +03:00 by kerem · 4 comments
Owner

Originally created by @edocevol on GitHub (Sep 29, 2025).
Original GitHub issue: https://github.com/hibiken/asynq/issues/1076

Originally assigned to: @hibiken, @kamikazechaser on GitHub.

var archiveCmd = redis.NewScript(`
if redis.call("LREM", KEYS[2], 0, ARGV[1]) == 0 then
  return redis.error_reply("NOT FOUND")
end
if redis.call("ZREM", KEYS[3], ARGV[1]) == 0 then
  return redis.error_reply("NOT FOUND")
end
redis.call("ZADD", KEYS[4], ARGV[3], ARGV[1])
local old = redis.call("ZRANGE", KEYS[4], "-inf", ARGV[4], "BYSCORE")

we should using

redis.call("ZRANGEBYSCORE", KEYS[4], "-inf", ARGV[4])
Originally created by @edocevol on GitHub (Sep 29, 2025). Original GitHub issue: https://github.com/hibiken/asynq/issues/1076 Originally assigned to: @hibiken, @kamikazechaser on GitHub. ```lua var archiveCmd = redis.NewScript(` if redis.call("LREM", KEYS[2], 0, ARGV[1]) == 0 then return redis.error_reply("NOT FOUND") end if redis.call("ZREM", KEYS[3], ARGV[1]) == 0 then return redis.error_reply("NOT FOUND") end redis.call("ZADD", KEYS[4], ARGV[3], ARGV[1]) local old = redis.call("ZRANGE", KEYS[4], "-inf", ARGV[4], "BYSCORE") ``` we should using ```lua redis.call("ZRANGEBYSCORE", KEYS[4], "-inf", ARGV[4]) ```
kerem 2026-03-07 22:10:59 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@edocevol commented on GitHub (Sep 29, 2025):

See too: https://github.com/hibiken/asynq/pull/1005

<!-- gh-comment-id:3345062596 --> @edocevol commented on GitHub (Sep 29, 2025): See too: https://github.com/hibiken/asynq/pull/1005
Author
Owner

@thomas4019 commented on GitHub (Oct 5, 2025):

@edocevol out of curiosity why are you using redis 4? It looks like that version hasn't had an update since 2019 and is end of life. It does seem like the docs should here should be updated to state a higher redis version is needed though.

<!-- gh-comment-id:3368720730 --> @thomas4019 commented on GitHub (Oct 5, 2025): @edocevol out of curiosity why are you using redis 4? It looks like that version hasn't had an update since 2019 and is end of life. It does seem like the docs should here should be updated to state a higher redis version is needed though.
Author
Owner

@edocevol commented on GitHub (Oct 11, 2025):

Our products have been uniformly using Redis 4 since 2017. As a continuation of the technology, I am currently unable to push the team to introduce a new version of Redis (at least it needs to be upgraded to version 6) in order to use the cmd mentioned in the issue.

Additionally, noticed that all other func of using "BYSCORE" have been rewrite correctly, leaving only this one.

If we have upgraded to the latest version, combine the stream functionality (for persistence) to better achieve the capabilities of a message queue?

<!-- gh-comment-id:3392836718 --> @edocevol commented on GitHub (Oct 11, 2025): Our products have been uniformly using Redis 4 since 2017. As a continuation of the technology, I am currently unable to push the team to introduce a new version of Redis (at least it needs to be upgraded to version 6) in order to use the cmd mentioned in the issue. Additionally, noticed that all other func of using "BYSCORE" have been rewrite correctly, leaving only this one. If we have upgraded to the latest version, combine the stream functionality (for persistence) to better achieve the capabilities of a message queue?
Author
Owner

@kamikazechaser commented on GitHub (Nov 4, 2025):

For redis 7.0 and below: I'd suggest forking building with your own patched version (replace directive).

<!-- gh-comment-id:3486713388 --> @kamikazechaser commented on GitHub (Nov 4, 2025): For redis 7.0 and below: I'd suggest forking building with your own patched version (replace directive).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#1526
No description provided.