mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 10:22:39 +01:00
Log rabbitmq channel allocations 2
This commit is contained in:
parent
b2769812fa
commit
e018b3ab1b
@ -82,7 +82,7 @@ export async function setupListener(this: WebSocket) {
|
|||||||
|
|
||||||
const opts: {
|
const opts: {
|
||||||
acknowledge: boolean;
|
acknowledge: boolean;
|
||||||
channel?: AMQChannel & { queues?: unknown };
|
channel?: AMQChannel & { queues?: unknown, ch?: number };
|
||||||
} = {
|
} = {
|
||||||
acknowledge: true,
|
acknowledge: true,
|
||||||
};
|
};
|
||||||
@ -91,10 +91,10 @@ export async function setupListener(this: WebSocket) {
|
|||||||
|
|
||||||
console.log("[RabbitMQ] setupListener: open for ", this.user_id);
|
console.log("[RabbitMQ] setupListener: open for ", this.user_id);
|
||||||
if (RabbitMQ.connection) {
|
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 = await RabbitMQ.connection.createChannel();
|
||||||
opts.channel.queues = {};
|
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);
|
this.events[this.user_id] = await listenEvent(this.user_id, consumer, opts);
|
||||||
@ -132,7 +132,7 @@ export async function setupListener(this: WebSocket) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.once("close", () => {
|
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();
|
if (opts.channel) opts.channel.close();
|
||||||
else {
|
else {
|
||||||
Object.values(this.events).forEach((x) => x?.());
|
Object.values(this.events).forEach((x) => x?.());
|
||||||
|
Loading…
Reference in New Issue
Block a user