Fix RDB.AggregationCheck when run against an empty group

This commit is contained in:
Ken Hibino
2022-03-10 11:54:47 -08:00
parent b29fe58434
commit 4b35eb0e1a
2 changed files with 23 additions and 0 deletions

View File

@@ -1009,6 +1009,9 @@ func (r *RDB) ListGroups(qname string) ([]string, error) {
// Returns 1 if an aggregation set was created
var aggregationCheckCmd = redis.NewScript(`
local size = redis.call("ZCARD", KEYS[1])
if size == 0 then
return 0
end
local maxSize = tonumber(ARGV[1])
if size >= maxSize then
local msgs = redis.call("ZRANGE", KEYS[1], 0, maxSize-1)