-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Save results for storages (#369)
* Feature: Save results for storages Currently just the status is stored, this PR adds the ability to save the result * fix: result from storage * fix: kill and abort issue
- Loading branch information
1 parent
97ff348
commit 4ad94d2
Showing
13 changed files
with
169 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/apalis-redis/lua/ack_job.lua → packages/apalis-redis/lua/done_job.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
-- KEYS[1]: this consumer's inflight set | ||
-- KEYS[2]: the dead jobs set | ||
-- KEYS[3]: the job data hash | ||
|
||
-- ARGV[1]: the job ID | ||
-- ARGV[2]: the current time | ||
-- ARGV[3]: the serialized job data | ||
|
||
-- ARGV[3]: the result of the job | ||
-- Returns: nil | ||
|
||
-- Remove the job from this consumer's inflight set | ||
local removed = redis.call("srem", KEYS[1], ARGV[1]) | ||
|
||
if removed == 1 then | ||
-- Push the job on to the dead jobs set | ||
redis.call("zadd", KEYS[2], ARGV[2], ARGV[1]) | ||
-- Push the job on to the dead jobs set | ||
redis.call("zadd", KEYS[2], ARGV[2], ARGV[1]) | ||
|
||
-- Reset the job data | ||
redis.call("hset", KEYS[3], ARGV[1], ARGV[3]) | ||
-- Save the result of the job | ||
local ns = "::result" | ||
redis.call("hmset", KEYS[3] .. ns, ARGV[1], ARGV[3]) | ||
|
||
return 1 | ||
return 1 | ||
end | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.