mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 03:28:00 +01:00
Don't panic if a queue exists, but is empty when repairing metadata.
This commit is contained in:
committed by
Jon Chambers
parent
899b54c082
commit
bb087caddc
@@ -1,13 +1,10 @@
|
||||
local queueKey = KEYS[1]
|
||||
local queueMetadataKey = KEYS[2]
|
||||
local queueKey = KEYS[1]
|
||||
local queueMetadataKey = KEYS[2]
|
||||
|
||||
local firstMessageWithScore = redis.call("ZRANGE", queueKey, 0, 0, "WITHSCORES")
|
||||
local lastMessageWithScore = redis.call("ZRANGE", queueKey, -1, -1, "WITHSCORES")
|
||||
|
||||
if firstMessageWithScore ~= nil and lastMessageWithScore ~= nil then
|
||||
local firstMessageId = tonumber(firstMessageWithScore[2])
|
||||
local lastMessageId = tonumber(lastMessageWithScore[2])
|
||||
local firstMessageId = tonumber(redis.call("ZRANGE", queueKey, 0, 0, "WITHSCORES")[2])
|
||||
local lastMessageId = tonumber(redis.call("ZRANGE", queueKey, -1, -1, "WITHSCORES")[2])
|
||||
|
||||
if firstMessageId and lastMessageId then
|
||||
for messageId = firstMessageId,lastMessageId do
|
||||
if redis.call("ZRANGEBYSCORE", queueKey, messageId, messageId) then
|
||||
-- This message actually exists, and its GUID may be pointing to the wrong ID
|
||||
|
||||
Reference in New Issue
Block a user