mirror of
https://github.com/hibiken/asynq.git
synced 2025-04-22 08:40:22 +08:00
Update all variants of RDB.RunAll methods
This commit is contained in:
parent
0f09f936a9
commit
ef0c390642
@ -513,12 +513,12 @@ func (r *RDB) removeAndRun(zset, qkey, id string) (int64, error) {
|
||||
}
|
||||
|
||||
var removeAndRunAllCmd = redis.NewScript(`
|
||||
local msgs = redis.call("ZRANGE", KEYS[1], 0, -1)
|
||||
for _, msg in ipairs(msgs) do
|
||||
redis.call("LPUSH", KEYS[2], msg)
|
||||
redis.call("ZREM", KEYS[1], msg)
|
||||
local ids = redis.call("ZRANGE", KEYS[1], 0, -1)
|
||||
for _, id in ipairs(ids) do
|
||||
redis.call("LPUSH", KEYS[2], id)
|
||||
redis.call("ZREM", KEYS[1], id)
|
||||
end
|
||||
return table.getn(msgs)`)
|
||||
return table.getn(ids)`)
|
||||
|
||||
func (r *RDB) removeAndRunAll(zset, qkey string) (int64, error) {
|
||||
res, err := removeAndRunAllCmd.Run(r.client, []string{zset, qkey}).Result()
|
||||
|
@ -1511,7 +1511,7 @@ func TestRunAllRetryTasks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunAllDeadTasks(t *testing.T) {
|
||||
func TestRunAllArchivedTasks(t *testing.T) {
|
||||
r := setup(t)
|
||||
defer r.Close()
|
||||
t1 := h.NewTaskMessage("send_email", nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user