mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 04:38:03 +01:00
Detect message delivery loops
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
local firstMessageGuidKey = KEYS[1]
|
||||
local firstMessageAttemptsKey = KEYS[2]
|
||||
|
||||
local firstMessageGuid = ARGV[1]
|
||||
local ttlSeconds = ARGV[2]
|
||||
|
||||
if firstMessageGuid ~= redis.call("GET", firstMessageGuidKey) then
|
||||
-- This is the first time we've attempted to deliver this message as the first message in a "page"
|
||||
redis.call("SET", firstMessageGuidKey, firstMessageGuid, "EX", ttlSeconds)
|
||||
redis.call("SET", firstMessageAttemptsKey, 0, "EX", ttlSeconds)
|
||||
end
|
||||
|
||||
return redis.call("INCR", firstMessageAttemptsKey)
|
||||
Reference in New Issue
Block a user