( queue: IManagedQueue )
| 59 | ] as const; |
| 60 | |
| 61 | const fetchQueueCounts = async ( |
| 62 | queue: IManagedQueue |
| 63 | ): Promise<IQueueCounts> => { |
| 64 | const counts = await queue.getJobCounts(...QUEUE_COUNT_STATES); |
| 65 | |
| 66 | return { |
| 67 | waiting: counts.waiting ?? 0, |
| 68 | active: counts.active ?? 0, |
| 69 | completed: counts.completed ?? 0, |
| 70 | failed: counts.failed ?? 0, |
| 71 | delayed: counts.delayed ?? 0, |
| 72 | paused: counts.paused ?? 0, |
| 73 | }; |
| 74 | }; |
| 75 | |
| 76 | /** |
| 77 | * Centralized lifecycle + dispatch surface for every BullMQ queue in the |