durable-actors 0.12.2

Standalone regional durable-actors control plane, host, and durability runtime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local event = cjson.decode(ARGV[1])
local previous = redis.call('GET', KEYS[1])
local corrected = 0
if previous then
    local state = cjson.decode(previous)
    local old = cjson.decode(state.event)
    if event.sequence <= old.sequence or old.kind == 'stopped' then return 0 end
    if state.estimated then corrected = 1 end
end
redis.call('SET', KEYS[1], cjson.encode({event = ARGV[1], estimated = false}), 'PX', ARGV[4])
if event.kind == 'stopped' then
    redis.call('ZREM', KEYS[2], ARGV[2])
else
    redis.call('ZADD', KEYS[2], event.receivedAtMs + tonumber(ARGV[3]), ARGV[2])
end
return corrected