mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 03:18:04 +01:00
Use reactive streams for WebSocket message queue
Initially, uses `ExperimentEnrollmentManager` to do a safe rollout.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local queueKey = KEYS[1]
|
||||
local queueLockKey = KEYS[2]
|
||||
local limit = ARGV[1]
|
||||
local afterMessageId = ARGV[2]
|
||||
|
||||
local locked = redis.call("GET", queueLockKey)
|
||||
|
||||
@@ -8,12 +9,17 @@ if locked then
|
||||
return {}
|
||||
end
|
||||
|
||||
-- The range is inclusive
|
||||
local min = 0
|
||||
local max = limit - 1
|
||||
if afterMessageId == "null" then
|
||||
-- An index range is inclusive
|
||||
local min = 0
|
||||
local max = limit - 1
|
||||
|
||||
if max < 0 then
|
||||
return {}
|
||||
if max < 0 then
|
||||
return {}
|
||||
end
|
||||
|
||||
return redis.call("ZRANGE", queueKey, min, max, "WITHSCORES")
|
||||
else
|
||||
-- note: this is deprecated in Redis 6.2, and should be migrated to zrange after the cluster is updated
|
||||
return redis.call("ZRANGEBYSCORE", queueKey, "("..afterMessageId, "+inf", "WITHSCORES", "LIMIT", 0, limit)
|
||||
end
|
||||
|
||||
return redis.call("ZRANGE", queueKey, min, max, "WITHSCORES")
|
||||
|
||||
Reference in New Issue
Block a user