Prevent Redis message seq regression

This commit is contained in:
richjohnrambo
2026-09-04 16:39:32 +08:00
parent e6f2cbf36e
commit 4ad6ca00b4
+4 -1
View File
@@ -410,7 +410,10 @@ func (r *redisGroupMessageRuntime) NextSeq(tenantID types.TenantID, topic string
} }
seqKey := r.seqKey(tenantID, topic) seqKey := r.seqKey(tenantID, topic)
seq, err := r.client.Eval(context.Background(), ` 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]) redis.call("SET", KEYS[1], ARGV[1])
end end
return redis.call("INCR", KEYS[1]) return redis.call("INCR", KEYS[1])