Detect message delivery loops

This commit is contained in:
Jon Chambers
2024-08-30 16:27:21 -04:00
committed by GitHub
parent 4c628b1cd9
commit f09cc03164
10 changed files with 182 additions and 13 deletions

View File

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