isMaxed-2.js 694 B

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