more fixes

pull/29/head
Matthew 2020-10-29 01:45:01 -04:00
parent 5072aab510
commit c13c19c080
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 21 additions and 0 deletions

View File

@ -15,6 +15,26 @@ export default class Queue {
this.setProcessors(); this.setProcessors();
} }
public async jobCounts() {
const data = {
waiting: 0,
active: 0,
completed: 0,
failed: 0,
delayed: 0,
};
for (const entry of Object.entries(this.queues)) {
// eslint-disable-next-line no-await-in-loop
const counts = await entry[1].getJobCounts();
data.waiting += counts.waiting;
data.active += counts.active;
data.completed += counts.completed;
data.failed += counts.failed;
data.delayed += counts.delayed;
}
return data;
}
protected listeners() { protected listeners() {
this.queues.score.on('active', (job) => { this.queues.score.on('active', (job) => {
this.client.util.signale.pending(`${job.id} has become active.`); this.client.util.signale.pending(`${job.id} has become active.`);

View File

@ -26,6 +26,7 @@ export default class Stats extends Command {
embed.addField('Commands Executed', `${commands.value}`, true); embed.addField('Commands Executed', `${commands.value}`, true);
embed.addField('HTTP Requests Served', `${requests.value}`, true); embed.addField('HTTP Requests Served', `${requests.value}`, true);
embed.addField('Pages Sent', `${pages.value}`, true); embed.addField('Pages Sent', `${pages.value}`, true);
embed.addField('Jobs Processed', `${(await this.client.queue.jobCounts()).completed}`, true);
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);
embed.setTimestamp(); embed.setTimestamp();
return message.channel.createMessage({ embed }); return message.channel.createMessage({ embed });