(ui): Fix inconsistent data shown in AggregatingTasks view

This commit is contained in:
Ken Hibino
2022-04-01 11:57:00 -07:00
parent 9de7f054bc
commit d0a8b6b691
6 changed files with 36 additions and 8 deletions

View File

@@ -306,6 +306,11 @@ func newListAggregatingTasksHandlerFunc(inspector *asynq.Inspector, pf PayloadFo
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
groups, err := inspector.Groups(qname)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
payload := make(map[string]interface{})
if len(tasks) == 0 {
// avoid nil for the tasks field in json output.
@@ -314,6 +319,7 @@ func newListAggregatingTasksHandlerFunc(inspector *asynq.Inspector, pf PayloadFo
payload["tasks"] = toAggregatingTasks(tasks, pf)
}
payload["stats"] = toQueueStateSnapshot(qinfo)
payload["groups"] = toGroupInfos(groups)
writeResponseJSON(w, payload)
}
}