mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 01:48:03 +01:00
Add support for scheduling background push notifications
This commit is contained in:
committed by
Jon Chambers
parent
c2be0af9d9
commit
5f6b66dad6
@@ -0,0 +1,17 @@
|
||||
local lastBackgroundNotificationTimestampKey = KEYS[1]
|
||||
local queueKey = KEYS[2]
|
||||
|
||||
local accountDevicePair = ARGV[1]
|
||||
local currentTimeMillis = tonumber(ARGV[2])
|
||||
local backgroundNotificationPeriod = tonumber(ARGV[3])
|
||||
|
||||
local lastBackgroundNotificationTimestamp = redis.call("GET", lastBackgroundNotificationTimestampKey)
|
||||
local nextNotificationTimestamp
|
||||
|
||||
if (lastBackgroundNotificationTimestamp) then
|
||||
nextNotificationTimestamp = tonumber(lastBackgroundNotificationTimestamp) + backgroundNotificationPeriod
|
||||
else
|
||||
nextNotificationTimestamp = currentTimeMillis
|
||||
end
|
||||
|
||||
redis.call("ZADD", queueKey, "NX", nextNotificationTimestamp, accountDevicePair)
|
||||
Reference in New Issue
Block a user