-
Notifications
You must be signed in to change notification settings - Fork 390
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(drain): consider checking parent jobs when draining #992
Merged
roggervalf
merged 15 commits into
master
from
fix-consider-parent-dependencies-in-drain
Jan 28, 2022
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b4e7d5a
fix(drain): consider checking parent jobs when draining
roggervalf 72cdfb4
refactor(remove-job): consider hard-delete for parent jobs
roggervalf b8afe2f
refactor(dran-obliterate): pass timestamp
roggervalf e288a29
fix(count): consider waiting-children state
roggervalf 939b7d8
test(obliterate): add flow test cases
roggervalf 6b4ca19
docs(removing-job): add documentation
roggervalf 5886c6a
docs(queues): adding removing jobs section
roggervalf ab7b19f
docs(removing-jobs): rewrite warnings
roggervalf 2983a7e
chore: separate phrases in 2 blocks
roggervalf 64eef6d
refactor(include): do not move parent to failed
roggervalf 7ab9482
refactor: separate duplicated code into function
roggervalf a9c711e
refactor: adjust documentation
roggervalf ffb974b
chore: merge branch master
roggervalf 74479e3
docs(removing-job): change typos
roggervalf 745349d
docs(removing-jobs): change typo
roggervalf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--[[ | ||
Functions remove jobs. | ||
]] | ||
local function getListItems(keyName, max) | ||
return rcall('LRANGE', keyName, 0, max - 1) | ||
end | ||
|
||
local function getZSetItems(keyName, max) | ||
return rcall('ZRANGE', keyName, 0, max - 1) | ||
end | ||
|
||
--- @include "removeParentDependencyKey" | ||
|
||
local function removeJobs(keys, baseKey, max) | ||
for i, key in ipairs(keys) do | ||
local jobKey = baseKey .. key | ||
removeParentDependencyKey(jobKey) | ||
rcall("DEL", jobKey) | ||
rcall("DEL", jobKey .. ':logs') | ||
rcall("DEL", jobKey .. ':dependencies') | ||
rcall("DEL", jobKey .. ':processed') | ||
end | ||
return max - #keys | ||
end | ||
|
||
local function removeListJobs(keyName, baseKey, max) | ||
local jobs = getListItems(keyName, max) | ||
local count = removeJobs(jobs, baseKey, max) | ||
rcall("LTRIM", keyName, #jobs, -1) | ||
return count | ||
end | ||
|
||
local function removeZSetJobs(keyName, baseKey, max) | ||
local jobs = getZSetItems(keyName, max) | ||
local count = removeJobs(jobs, baseKey, max) | ||
if(#jobs > 0) then | ||
rcall("ZREM", keyName, unpack(jobs)) | ||
end | ||
return count | ||
end |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this job is the parent that was moved to wait state, before it was in waiting-children state