From cac7636bbcc18876308c153434a8d36c5c17d97d Mon Sep 17 00:00:00 2001 From: cn-kali-team Date: Fri, 6 Jan 2023 18:23:40 +0800 Subject: [PATCH] fix empty id --- internal/rdb/inspect.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/rdb/inspect.go b/internal/rdb/inspect.go index 6deb4f1..e673c80 100644 --- a/internal/rdb/inspect.go +++ b/internal/rdb/inspect.go @@ -661,6 +661,7 @@ for _, id in ipairs(ids) do local msg, result = unpack(redis.call("HMGET", key, "msg","result")) table.insert(data, msg) table.insert(data, result) + table.insert(data, id) end return data `) @@ -690,7 +691,7 @@ func (r *RDB) listMessages(qname string, state base.TaskState, pgn Pagination) ( return nil, errors.E(errors.Internal, fmt.Errorf("cast error: Lua script returned unexpected value: %v", res)) } var infos []*base.TaskInfo - for i := 0; i < len(data); i += 2 { + for i := 0; i < len(data); i += 3 { m, err := base.DecodeMessage([]byte(data[i])) if err != nil { continue // bad data, ignore and continue @@ -703,6 +704,9 @@ func (r *RDB) listMessages(qname string, state base.TaskState, pgn Pagination) ( if state == base.TaskStatePending { nextProcessAt = r.clock.Now() } + if m.ID == "" { + m.ID = data[i+2] + } infos = append(infos, &base.TaskInfo{ Message: m, State: state,