Use reactive streams for WebSocket message queue

Initially, uses `ExperimentEnrollmentManager` to do a safe rollout.
This commit is contained in:
Chris Eager
2022-10-31 10:35:37 -05:00
committed by GitHub
parent 4252284405
commit c10fda8363
32 changed files with 2359 additions and 1260 deletions

View File

@@ -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")