-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(worker): process job when closing and it was moved to active #3042
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ else | |
end | ||
end | ||
|
||
local deduplicationJobId = deduplicateJob(args[1], opts['de'], | ||
local deduplicationJobId = deduplicateJob(opts['de'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unrelated fix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused variable, not a fix, just re formatting |
||
jobId, deduplicationKey, eventsKey, maxEvents) | ||
if deduplicationJobId then | ||
return deduplicationJobId | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
--[[ | ||
Function to debounce a job. | ||
Function to deduplicate a job. | ||
]] | ||
|
||
local function deduplicateJob(prefixKey, deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents) | ||
local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems to be an unrelated fix. |
||
local deduplicationId = deduplicationOpts and deduplicationOpts['id'] | ||
if deduplicationId then | ||
local ttl = deduplicationOpts['ttl'] | ||
local deduplicationKeyExists | ||
if ttl then | ||
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX') | ||
deduplicationKeyExists = rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX') | ||
else | ||
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX') | ||
deduplicationKeyExists = rcall('SET', deduplicationKey, jobId, 'NX') | ||
end | ||
if deduplicationKeyExists then | ||
local currentDebounceJobId = rcall('GET', deduplicationKey) | ||
if deduplicationKeyExists == false then | ||
local currentDeduplicatedJobId = rcall('GET', deduplicationKey) | ||
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", | ||
"debounced", "jobId", currentDebounceJobId, "debounceId", deduplicationId) | ||
"debounced", "jobId", currentDeduplicatedJobId, "debounceId", deduplicationId) | ||
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", | ||
"deduplicated", "jobId", currentDebounceJobId, "deduplicationId", deduplicationId) | ||
return currentDebounceJobId | ||
"deduplicated", "jobId", currentDeduplicatedJobId, "deduplicationId", deduplicationId) | ||
return currentDeduplicatedJobId | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, as the signature of this method already guarantees that the job cannot be undefined or null