mirror of
https://github.com/hibiken/asynq.git
synced 2025-04-23 09:10:19 +08:00
(asynq): Add Completed field to QueueInfo struct
This commit is contained in:
parent
0d5218329c
commit
a79f2d9c7f
@ -66,6 +66,8 @@ type QueueInfo struct {
|
|||||||
Retry int
|
Retry int
|
||||||
// Number of archived tasks.
|
// Number of archived tasks.
|
||||||
Archived int
|
Archived int
|
||||||
|
// Number of stored completed tasks.
|
||||||
|
Completed int
|
||||||
|
|
||||||
// Total number of tasks being processed during the given date.
|
// Total number of tasks being processed during the given date.
|
||||||
// The number includes both succeeded and failed tasks.
|
// The number includes both succeeded and failed tasks.
|
||||||
@ -99,6 +101,7 @@ func (i *Inspector) GetQueueInfo(qname string) (*QueueInfo, error) {
|
|||||||
Scheduled: stats.Scheduled,
|
Scheduled: stats.Scheduled,
|
||||||
Retry: stats.Retry,
|
Retry: stats.Retry,
|
||||||
Archived: stats.Archived,
|
Archived: stats.Archived,
|
||||||
|
Completed: stats.Completed,
|
||||||
Processed: stats.Processed,
|
Processed: stats.Processed,
|
||||||
Failed: stats.Failed,
|
Failed: stats.Failed,
|
||||||
Paused: stats.Paused,
|
Paused: stats.Paused,
|
||||||
|
@ -276,6 +276,7 @@ func TestInspectorGetQueueInfo(t *testing.T) {
|
|||||||
scheduled map[string][]base.Z
|
scheduled map[string][]base.Z
|
||||||
retry map[string][]base.Z
|
retry map[string][]base.Z
|
||||||
archived map[string][]base.Z
|
archived map[string][]base.Z
|
||||||
|
completed map[string][]base.Z
|
||||||
processed map[string]int
|
processed map[string]int
|
||||||
failed map[string]int
|
failed map[string]int
|
||||||
qname string
|
qname string
|
||||||
@ -310,6 +311,11 @@ func TestInspectorGetQueueInfo(t *testing.T) {
|
|||||||
"critical": {},
|
"critical": {},
|
||||||
"low": {},
|
"low": {},
|
||||||
},
|
},
|
||||||
|
completed: map[string][]base.Z{
|
||||||
|
"default": {},
|
||||||
|
"critical": {},
|
||||||
|
"low": {},
|
||||||
|
},
|
||||||
processed: map[string]int{
|
processed: map[string]int{
|
||||||
"default": 120,
|
"default": 120,
|
||||||
"critical": 100,
|
"critical": 100,
|
||||||
@ -329,6 +335,7 @@ func TestInspectorGetQueueInfo(t *testing.T) {
|
|||||||
Scheduled: 2,
|
Scheduled: 2,
|
||||||
Retry: 0,
|
Retry: 0,
|
||||||
Archived: 0,
|
Archived: 0,
|
||||||
|
Completed: 0,
|
||||||
Processed: 120,
|
Processed: 120,
|
||||||
Failed: 2,
|
Failed: 2,
|
||||||
Paused: false,
|
Paused: false,
|
||||||
@ -344,6 +351,7 @@ func TestInspectorGetQueueInfo(t *testing.T) {
|
|||||||
h.SeedAllScheduledQueues(t, r, tc.scheduled)
|
h.SeedAllScheduledQueues(t, r, tc.scheduled)
|
||||||
h.SeedAllRetryQueues(t, r, tc.retry)
|
h.SeedAllRetryQueues(t, r, tc.retry)
|
||||||
h.SeedAllArchivedQueues(t, r, tc.archived)
|
h.SeedAllArchivedQueues(t, r, tc.archived)
|
||||||
|
h.SeedAllCompletedQueues(t, r, tc.completed)
|
||||||
for qname, n := range tc.processed {
|
for qname, n := range tc.processed {
|
||||||
processedKey := base.ProcessedKey(qname, now)
|
processedKey := base.ProcessedKey(qname, now)
|
||||||
r.Set(context.Background(), processedKey, n, 0)
|
r.Set(context.Background(), processedKey, n, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user