Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix(ProcessBootstrapper): debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazmi35 authored Feb 24, 2024
1 parent d93de4f commit d9480b7
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,25 @@ export class ProcessBootstrapper {
if (!message) return;
const content = JSON.parse(message.content.toString()) as { op: ShardOp; data: unknown; };
const shardId = ShardedRoutedQueue.routingKeyToShardId(message.fields.routingKey);
this.logger.debug(content, `Received message from AMQP to shard ${shardId}`);
if (shardId === null) return;
if (!this.shards.has(shardId)) return;
channel.ack(message);
this.logger.debug(content, `Processing message from AMQP to shard ${shardId}`);
switch (content.op) {
case ShardOp.SEND: {
const shard = this.shards.get(shardId);
this.logger.debug(content, `Received message from AMQP to send to shard ${shardId}`);
if (shard) {
await shard.send(content.data as GatewaySendPayload);
}
break;
}
case ShardOp.CONNECT: {
this.logger.debug(content, `Received message from AMQP to connect shard ${shardId}`);
await this.connect(shardId);
break;
}
case ShardOp.RESTART: {
const shard = this.shards.get(shardId);
this.logger.debug(content, `Received message from AMQP to restart shard ${shardId}`);
if (shard) {
await this.destroy(shardId, content.data as WebSocketShardDestroyOptions);
await this.connect(shardId);
Expand Down

0 comments on commit d9480b7

Please sign in to comment.