Skip to content

Commit

Permalink
feat(status): Reduce data sent
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Crespi committed Dec 16, 2019
1 parent a3fe00b commit a9c360e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/framework/services/RabbitMq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ export class RabbitMqService {

public async sendStatusToManager(err?: Error) {
const req = (this.client as any).requestHandler;
const queued = {} as any;
Object.keys(req.ratelimits).forEach(endpoint => (queued[endpoint] = req.ratelimits[endpoint]._queue.length));
const queued = Object.keys(req.ratelimits).reduce(
(acc, endpoint) => acc + (req.ratelimits[endpoint]._queue.length as number),
0
);

await this.sendToManager({
id: 'status',
Expand All @@ -158,7 +160,7 @@ export class RabbitMqService {
guilds: this.client.guilds.size,
error: err ? err.message : null,
tracking: {
pendingGuilds: [...this.client.tracking.pendingGuilds.values()],
pendingGuilds: this.client.tracking.pendingGuilds.size,
initialPendingGuilds: this.client.tracking.initialPendingGuilds
},
music: {
Expand Down

0 comments on commit a9c360e

Please sign in to comment.