isQueueMaxed.lua 354 B

123456789101112131415
  1. --[[
  2. Function to check if queue is maxed or not.
  3. ]]
  4. local function isQueueMaxed(queueMetaKey, activeKey)
  5. local maxConcurrency = rcall("HGET", queueMetaKey, "concurrency")
  6. if maxConcurrency then
  7. local activeCount = rcall("LLEN", activeKey)
  8. if activeCount >= tonumber(maxConcurrency) then
  9. return true
  10. end
  11. end
  12. return false
  13. end