-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
235 additions
and
65 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
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
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,12 +1,16 @@ | ||
local broker_id = ARGV[1] | ||
local future_jobs = ARGV[2] | ||
local notifications = ARGV[3] | ||
local at_timestamp = ARGV[4] | ||
local job_json = ARGV[5] | ||
local job_id = ARGV[6] | ||
local running_jobs_key = ARGV[7] | ||
local notifications = ARGV[2] | ||
local running_jobs_key = ARGV[3] | ||
local future_jobs = ARGV[4] | ||
-- jobs starting at ARGV[5] | ||
|
||
redis.call('zadd', future_jobs, at_timestamp, job_json) | ||
redis.call('hdel', running_jobs_key, job_id) | ||
redis.call('publish', notifications, '') | ||
|
||
for i=5, #ARGV do | ||
local job_json = ARGV[i] | ||
local job = cjson.decode(job_json) | ||
local at_timestamp = job["at"] + 1 -- approximation to avoid starting a job before its real "at" date | ||
redis.call('zadd', future_jobs, at_timestamp, job_json) | ||
redis.call('hdel', running_jobs_key, job["id"]) | ||
end | ||
|
||
redis.call('publish', notifications, '') |
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,11 +1,15 @@ | ||
local broker_id = ARGV[1] | ||
local queue = ARGV[2] | ||
local notifications = ARGV[3] | ||
local job_json = ARGV[4] | ||
local job_id = ARGV[5] | ||
local running_jobs_key = ARGV[6] | ||
local notifications = ARGV[2] | ||
local running_jobs_key = ARGV[3] | ||
local namespace = ARGV[4] | ||
-- jobs starting at ARGV[5] | ||
|
||
redis.call('rpush', queue, job_json) | ||
redis.call('hdel', running_jobs_key, job_id) | ||
redis.call('publish', notifications, '') | ||
for i=5, #ARGV do | ||
local job_json = ARGV[i] | ||
local job = cjson.decode(job_json) | ||
local queue = string.format("%s/%s", namespace, job["queue"]) | ||
redis.call('rpush', queue, job_json) | ||
redis.call('hdel', running_jobs_key, job["id"]) | ||
end | ||
|
||
redis.call('publish', notifications, '') |
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
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.