mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-01 05:06:47 +00:00
20 lines
330 B
Lua
20 lines
330 B
Lua
local queueKey = KEYS[1]
|
|
local queueLockKey = KEYS[2]
|
|
local limit = ARGV[1]
|
|
|
|
local locked = redis.call("GET", queueLockKey)
|
|
|
|
if locked then
|
|
return {}
|
|
end
|
|
|
|
-- The range is inclusive
|
|
local min = 0
|
|
local max = limit - 1
|
|
|
|
if max < 0 then
|
|
return {}
|
|
end
|
|
|
|
return redis.call("ZRANGE", queueKey, min, max, "WITHSCORES")
|