Skip to content

Commit b276981

Browse files
Log rabbitmq channel allocations
1 parent 40b356e commit b276981

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/gateway/listener/listener.ts

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { WebSocket } from "@spacebar/gateway";
3434
import "missing-native-js-functions";
3535
import { Channel as AMQChannel } from "amqplib";
3636
import { Recipient } from "@spacebar/util";
37+
import * as console from "node:console";
3738

3839
// TODO: close connection on Invalidated Token
3940
// TODO: check intent
@@ -88,9 +89,12 @@ export async function setupListener(this: WebSocket) {
8889
this.listen_options = opts;
8990
const consumer = consume.bind(this);
9091

92+
console.log("[RabbitMQ] setupListener: open for ", this.user_id);
9193
if (RabbitMQ.connection) {
94+
console.log("[RabbitMQ] setupListener: opts.channel = ", typeof opts.channel, opts.channel);
9295
opts.channel = await RabbitMQ.connection.createChannel();
9396
opts.channel.queues = {};
97+
console.log("[RabbitMQ] channel created: ", typeof opts.channel, opts.channel);
9498
}
9599

96100
this.events[this.user_id] = await listenEvent(this.user_id, consumer, opts);
@@ -128,6 +132,7 @@ export async function setupListener(this: WebSocket) {
128132
});
129133

130134
this.once("close", () => {
135+
console.log("[RabbitMQ] setupListener: close for ", this.user_id, "=", typeof opts.channel, opts.channel);
131136
if (opts.channel) opts.channel.close();
132137
else {
133138
Object.values(this.events).forEach((x) => x?.());

0 commit comments

Comments
 (0)