summaryrefslogtreecommitdiff
path: root/src/daemons/queue-stats.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-03-12 10:35:17 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-03-12 10:35:17 +0900
commite7f81a42cedac513b8dc7321b48b2f7625552273 (patch)
treeaf64dc00a815c7cdbbb38a7e88526df40ac4a6f4 /src/daemons/queue-stats.ts
parentUpdate README.md [AUTOGEN] (#4477) (diff)
downloadsharkey-e7f81a42cedac513b8dc7321b48b2f7625552273.tar.gz
sharkey-e7f81a42cedac513b8dc7321b48b2f7625552273.tar.bz2
sharkey-e7f81a42cedac513b8dc7321b48b2f7625552273.zip
Resolve #4470
Diffstat (limited to 'src/daemons/queue-stats.ts')
-rw-r--r--src/daemons/queue-stats.ts26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/daemons/queue-stats.ts b/src/daemons/queue-stats.ts
index 41babb1c88..2d5a6fc1be 100644
--- a/src/daemons/queue-stats.ts
+++ b/src/daemons/queue-stats.ts
@@ -16,19 +16,41 @@ export default function() {
ev.emit(`queueStatsLog:${x.id}`, log.toArray().slice(0, x.length || 50));
});
+ let activeDeliverJobs = 0;
+ let activeInboxJobs = 0;
+
+ deliverQueue.on('active', () => {
+ activeDeliverJobs++;
+ });
+
+ inboxQueue.on('active', () => {
+ activeInboxJobs++;
+ });
+
async function tick() {
const deliverJobCounts = await deliverQueue.getJobCounts();
const inboxJobCounts = await inboxQueue.getJobCounts();
const stats = {
- deliver: deliverJobCounts,
- inbox: inboxJobCounts
+ deliver: {
+ active: activeDeliverJobs,
+ waiting: deliverJobCounts.waiting,
+ delyaed: deliverJobCounts.delayed
+ },
+ inbox: {
+ active: activeInboxJobs,
+ waiting: inboxJobCounts.waiting,
+ delyaed: inboxJobCounts.delayed
+ }
};
ev.emit('queueStats', stats);
log.unshift(stats);
if (log.length > 200) log.pop();
+
+ activeDeliverJobs = 0;
+ activeInboxJobs = 0;
}
tick();