Skip to content

Commit

Permalink
Fix: be sure to keep track the job context (#289)
Browse files Browse the repository at this point in the history
Ensure proper tracking of potential updates to context data (e.g.: Attempts) by deleting the job with `hdel` before executing the `hsetnx `command, as it does not perform data updates.
  • Loading branch information
killix authored May 27, 2024
1 parent f63480c commit 09235e9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/apalis-redis/lua/schedule_job.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

-- Returns: 1 if the job was newly scheduled, 0 if it already exists

-- delete the job to keep track of context
redis.call("HDEL", KEYS[1], ARGV[1])
-- Set job data in hash
local set = redis.call("hsetnx", KEYS[1], ARGV[1], ARGV[2])
redis.call("zadd", KEYS[2], ARGV[3], ARGV[1])
Expand Down

0 comments on commit 09235e9

Please sign in to comment.