mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 00:53:08 +02:00
Resolve #4470
This commit is contained in:
parent
ac614148b8
commit
e7f81a42ce
1 changed files with 24 additions and 2 deletions
|
@ -16,19 +16,41 @@ export default function() {
|
||||||
ev.emit(`queueStatsLog:${x.id}`, log.toArray().slice(0, x.length || 50));
|
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() {
|
async function tick() {
|
||||||
const deliverJobCounts = await deliverQueue.getJobCounts();
|
const deliverJobCounts = await deliverQueue.getJobCounts();
|
||||||
const inboxJobCounts = await inboxQueue.getJobCounts();
|
const inboxJobCounts = await inboxQueue.getJobCounts();
|
||||||
|
|
||||||
const stats = {
|
const stats = {
|
||||||
deliver: deliverJobCounts,
|
deliver: {
|
||||||
inbox: inboxJobCounts
|
active: activeDeliverJobs,
|
||||||
|
waiting: deliverJobCounts.waiting,
|
||||||
|
delyaed: deliverJobCounts.delayed
|
||||||
|
},
|
||||||
|
inbox: {
|
||||||
|
active: activeInboxJobs,
|
||||||
|
waiting: inboxJobCounts.waiting,
|
||||||
|
delyaed: inboxJobCounts.delayed
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ev.emit('queueStats', stats);
|
ev.emit('queueStats', stats);
|
||||||
|
|
||||||
log.unshift(stats);
|
log.unshift(stats);
|
||||||
if (log.length > 200) log.pop();
|
if (log.length > 200) log.pop();
|
||||||
|
|
||||||
|
activeDeliverJobs = 0;
|
||||||
|
activeInboxJobs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tick();
|
tick();
|
||||||
|
|
Loading…
Reference in a new issue