Prevent Redis message seq regression
This commit is contained in:
@@ -410,7 +410,10 @@ func (r *redisGroupMessageRuntime) NextSeq(tenantID types.TenantID, topic string
|
||||
}
|
||||
seqKey := r.seqKey(tenantID, topic)
|
||||
seq, err := r.client.Eval(context.Background(), `
|
||||
if redis.call("EXISTS", KEYS[1]) == 0 then
|
||||
local current = redis.call("GET", KEYS[1])
|
||||
if not current then
|
||||
redis.call("SET", KEYS[1], ARGV[1])
|
||||
elseif tonumber(current) < tonumber(ARGV[1]) then
|
||||
redis.call("SET", KEYS[1], ARGV[1])
|
||||
end
|
||||
return redis.call("INCR", KEYS[1])
|
||||
|
||||
Reference in New Issue
Block a user