mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-10 11:31:58 +08:00
fix: listLeaseExpiredCmd doesn't ignore possibly empty value of task in lua script
This commit is contained in:
parent
d0041c55a3
commit
1e0bf88bf3
@ -1284,7 +1284,10 @@ local res = {}
|
|||||||
local ids = redis.call("ZRANGEBYSCORE", KEYS[1], "-inf", ARGV[1])
|
local ids = redis.call("ZRANGEBYSCORE", KEYS[1], "-inf", ARGV[1])
|
||||||
for _, id in ipairs(ids) do
|
for _, id in ipairs(ids) do
|
||||||
local key = ARGV[2] .. id
|
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
|
end
|
||||||
return res
|
return res
|
||||||
`)
|
`)
|
||||||
@ -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))
|
return nil, errors.E(op, errors.Internal, fmt.Sprintf("cast error: Lua script returned unexpected value: %v", res))
|
||||||
}
|
}
|
||||||
for _, s := range data {
|
for _, s := range data {
|
||||||
if len(s) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
msg, err := base.DecodeMessage([]byte(s))
|
msg, err := base.DecodeMessage([]byte(s))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.E(op, errors.Internal, fmt.Sprintf("cannot decode message: %v", err))
|
return nil, errors.E(op, errors.Internal, fmt.Sprintf("cannot decode message: %v", err))
|
||||||
|
Loading…
Reference in New Issue
Block a user