-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(job): add breakRelationship method
- Loading branch information
1 parent
bfa1839
commit 3f3e262
Showing
5 changed files
with
148 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--[[ | ||
Break parent-child dependency by removing | ||
child reference from parent | ||
Input: | ||
KEYS[1] 'key' prefix, | ||
ARGV[1] job key | ||
ARGV[2] parent key | ||
Output: | ||
0 - OK | ||
1 - There is not relationship. | ||
-1 - Missing job key | ||
-5 - Missing parent key | ||
]] | ||
local rcall = redis.call | ||
local jobKey = ARGV[1] | ||
local parentKey = ARGV[2] | ||
|
||
-- Includes | ||
--- @include "includes/removeParentDependencyKey" | ||
|
||
if rcall("EXISTS", jobKey) ~= 1 then return -1 end | ||
|
||
if rcall("EXISTS", parentKey) ~= 1 then return -5 end | ||
|
||
if removeParentDependencyKey(jobKey, false, parentKey, KEYS[1]) then | ||
rcall("HDEL", jobKey, "parentKey", "parent") | ||
|
||
return 0 | ||
else | ||
return 1 | ||
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