Files
simple-mail-cleaner/backend/node_modules/bullmq/dist/cjs/scripts/isFinished-3.js
2026-01-22 15:49:12 +01:00

49 lines
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isFinished = void 0;
const content = `--[[
Checks if a job is finished (.i.e. is in the completed or failed set)
Input:
KEYS[1] completed key
KEYS[2] failed key
KEYS[3] job key
ARGV[1] job id
ARGV[2] return value?
Output:
0 - Not finished.
1 - Completed.
2 - Failed.
-1 - Missing job.
]]
local rcall = redis.call
if rcall("EXISTS", KEYS[3]) ~= 1 then
if ARGV[2] == "1" then
return {-1,"Missing key for job " .. KEYS[3] .. ". isFinished"}
end
return -1
end
if rcall("ZSCORE", KEYS[1], ARGV[1]) then
if ARGV[2] == "1" then
local returnValue = rcall("HGET", KEYS[3], "returnvalue")
return {1,returnValue}
end
return 1
end
if rcall("ZSCORE", KEYS[2], ARGV[1]) then
if ARGV[2] == "1" then
local failedReason = rcall("HGET", KEYS[3], "failedReason")
return {2,failedReason}
end
return 2
end
if ARGV[2] == "1" then
return {0}
end
return 0
`;
exports.isFinished = {
name: 'isFinished',
content,
keys: 3,
};
//# sourceMappingURL=isFinished-3.js.map