mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 00:38:02 +01:00
Gather IP-based metrics for international, unsealed-sender messages.
This commit is contained in:
committed by
Jon Chambers
parent
df9dc82de5
commit
f57a4171ba
@@ -0,0 +1,19 @@
|
||||
local destinationSetKey = KEYS[1]
|
||||
local messageCountKey = KEYS[2]
|
||||
|
||||
local destination = ARGV[1]
|
||||
|
||||
redis.call("PFADD", destinationSetKey, destination)
|
||||
local distinctDestinationCount = redis.call("PFCOUNT", destinationSetKey)
|
||||
|
||||
if redis.call("TTL", destinationSetKey) < 0 then
|
||||
redis.call("EXPIRE", destinationSetKey, 86400)
|
||||
end
|
||||
|
||||
local messageCount = redis.call("INCR", messageCountKey)
|
||||
|
||||
if messageCount == 1 then
|
||||
redis.call("EXPIRE", messageCountKey, 86400)
|
||||
end
|
||||
|
||||
return { distinctDestinationCount, messageCount }
|
||||
Reference in New Issue
Block a user