Skip to content

Commit

Permalink
Log rabbitmq channel allocations 2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheArcaneBrony committed Nov 2, 2024
1 parent b276981 commit e018b3a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gateway/listener/listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function setupListener(this: WebSocket) {

const opts: {
acknowledge: boolean;
channel?: AMQChannel & { queues?: unknown };
channel?: AMQChannel & { queues?: unknown, ch?: number };
} = {
acknowledge: true,
};
Expand All @@ -91,10 +91,10 @@ export async function setupListener(this: WebSocket) {

console.log("[RabbitMQ] setupListener: open for ", this.user_id);
if (RabbitMQ.connection) {
console.log("[RabbitMQ] setupListener: opts.channel = ", typeof opts.channel, opts.channel);
console.log("[RabbitMQ] setupListener: opts.channel = ", typeof opts.channel, "with channel id", opts.channel?.ch);
opts.channel = await RabbitMQ.connection.createChannel();
opts.channel.queues = {};
console.log("[RabbitMQ] channel created: ", typeof opts.channel, opts.channel);
console.log("[RabbitMQ] channel created: ", typeof opts.channel, "with channel id", opts.channel?.ch);
}

this.events[this.user_id] = await listenEvent(this.user_id, consumer, opts);
Expand Down Expand Up @@ -132,7 +132,7 @@ export async function setupListener(this: WebSocket) {
});

this.once("close", () => {
console.log("[RabbitMQ] setupListener: close for ", this.user_id, "=", typeof opts.channel, opts.channel);
console.log("[RabbitMQ] setupListener: close for", this.user_id, "=", typeof opts.channel, "with channel id", opts.channel?.ch);
if (opts.channel) opts.channel.close();
else {
Object.values(this.events).forEach((x) => x?.());
Expand Down

0 comments on commit e018b3a

Please sign in to comment.