isMaxed-2.js 792 B

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.isMaxed = void 0;
  4. const content = `--[[
  5. Checks if queue is maxed.
  6. Input:
  7. KEYS[1] meta key
  8. KEYS[2] active key
  9. Output:
  10. 1 if element found in the list.
  11. ]]
  12. local rcall = redis.call
  13. -- Includes
  14. --[[
  15. Function to check if queue is maxed or not.
  16. ]]
  17. local function isQueueMaxed(queueMetaKey, activeKey)
  18. local maxConcurrency = rcall("HGET", queueMetaKey, "concurrency")
  19. if maxConcurrency then
  20. local activeCount = rcall("LLEN", activeKey)
  21. if activeCount >= tonumber(maxConcurrency) then
  22. return true
  23. end
  24. end
  25. return false
  26. end
  27. return isQueueMaxed(KEYS[1], KEYS[2])
  28. `;
  29. exports.isMaxed = {
  30. name: 'isMaxed',
  31. content,
  32. keys: 2,
  33. };
  34. //# sourceMappingURL=isMaxed-2.js.map