Skip to content

Commit

Permalink
fix: listLeaseExpiredCmd doesn't ignore possibly empty value of task …
Browse files Browse the repository at this point in the history
…in lua script
  • Loading branch information
yeqown authored and hibiken committed Dec 10, 2023
1 parent d0041c5 commit 1e0bf88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/rdb/rdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,10 @@ local res = {}
local ids = redis.call("ZRANGEBYSCORE", KEYS[1], "-inf", ARGV[1])
for _, id in ipairs(ids) do
local key = ARGV[2] .. id
table.insert(res, redis.call("HGET", key, "msg"))
local v = redis.call("HGET", key, "msg")
if v then
table.insert(res, v)
end
end
return res
`)
Expand All @@ -1305,9 +1308,6 @@ func (r *RDB) ListLeaseExpired(cutoff time.Time, qnames ...string) ([]*base.Task
return nil, errors.E(op, errors.Internal, fmt.Sprintf("cast error: Lua script returned unexpected value: %v", res))
}
for _, s := range data {
if len(s) == 0 {
continue
}
msg, err := base.DecodeMessage([]byte(s))
if err != nil {
return nil, errors.E(op, errors.Internal, fmt.Sprintf("cannot decode message: %v", err))
Expand Down

0 comments on commit 1e0bf88

Please sign in to comment.