| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.getCountsPerPriority = void 0;
- const content = `--[[
- Get counts per provided states
- Input:
- KEYS[1] wait key
- KEYS[2] paused key
- KEYS[3] meta key
- KEYS[4] prioritized key
- ARGV[1...] priorities
- ]]
- local rcall = redis.call
- local results = {}
- local waitKey = KEYS[1]
- local pausedKey = KEYS[2]
- local prioritizedKey = KEYS[4]
- -- Includes
- --[[
- Function to check for the meta.paused key to decide if we are paused or not
- (since an empty list and !EXISTS are not really the same).
- ]]
- local function isQueuePaused(queueMetaKey)
- return rcall("HEXISTS", queueMetaKey, "paused") == 1
- end
- for i = 1, #ARGV do
- local priority = tonumber(ARGV[i])
- if priority == 0 then
- if isQueuePaused(KEYS[3]) then
- results[#results+1] = rcall("LLEN", pausedKey)
- else
- results[#results+1] = rcall("LLEN", waitKey)
- end
- else
- results[#results+1] = rcall("ZCOUNT", prioritizedKey,
- priority * 0x100000000, (priority + 1) * 0x100000000 - 1)
- end
- end
- return results
- `;
- exports.getCountsPerPriority = {
- name: 'getCountsPerPriority',
- content,
- keys: 4,
- };
- //# sourceMappingURL=getCountsPerPriority-4.js.map
|