Skip to content

Commit

Permalink
fix(startup): Respect large bot sharding
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Crespi committed Mar 30, 2020
1 parent 5475e2b commit 07d3418
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/framework/services/RabbitMq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { FakeChannel } from '../../util';

import { IMService } from './Service';

const BOT_SHARDING = 16;

interface ShardMessage {
id: string;
cmd: ShardCommand;
Expand Down Expand Up @@ -133,7 +135,8 @@ export class RabbitMqService extends IMService {
return;
}

this.qNameStartup = `shard-${this.client.instance}-start`;
const startupSuffix = this.client.shardCount > BOT_SHARDING ? `-${this.client.shardId % BOT_SHARDING}` : '';
this.qNameStartup = `shard-${this.client.instance}-start${startupSuffix}`;

this.channelStartup = await this.conn.createChannel();
this.channelStartup.on('close', async (err) => {
Expand Down

0 comments on commit 07d3418

Please sign in to comment.