mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 11:15:53 +08:00
Fix list queues handler
This commit is contained in:
parent
50b7af8421
commit
60872a1ad7
@ -20,14 +20,14 @@ func newListQueuesHandlerFunc(inspector *inspeq.Inspector) http.HandlerFunc {
|
|||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var snapshots []*QueueStateSnapshot
|
snapshots := make([]*QueueStateSnapshot, len(qnames))
|
||||||
for _, qname := range qnames {
|
for i, qname := range qnames {
|
||||||
s, err := inspector.CurrentStats(qname)
|
s, err := inspector.CurrentStats(qname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
snapshots = append(snapshots, toQueueStateSnapshot(s))
|
snapshots[i] = toQueueStateSnapshot(s)
|
||||||
}
|
}
|
||||||
payload := map[string]interface{}{"queues": snapshots}
|
payload := map[string]interface{}{"queues": snapshots}
|
||||||
json.NewEncoder(w).Encode(payload)
|
json.NewEncoder(w).Encode(payload)
|
||||||
|
Loading…
Reference in New Issue
Block a user