️ Close RabbitMQ connections left open after use (#1594)

This commit is contained in:
Allan Daemon 2021-04-13 13:27:25 -03:00 committed by GitHub
parent 8ed1099795
commit f4916c7efb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -355,6 +355,7 @@ export class RabbitMQ implements INodeType {
}); });
await channel.close(); await channel.close();
await channel.connection.close();
} }
else if (mode === 'exchange') { else if (mode === 'exchange') {
const exchange = this.getNodeParameter('exchange', 0) as string; const exchange = this.getNodeParameter('exchange', 0) as string;
@ -419,6 +420,7 @@ export class RabbitMQ implements INodeType {
}); });
await channel.close(); await channel.close();
await channel.connection.close();
} else { } else {
throw new Error(`The operation "${mode}" is not known!`); throw new Error(`The operation "${mode}" is not known!`);
} }
@ -428,6 +430,7 @@ export class RabbitMQ implements INodeType {
catch (error) { catch (error) {
if (channel) { if (channel) {
await channel.close(); await channel.close();
await channel.connection.close();
} }
throw error; throw error;
} }

View file

@ -151,6 +151,7 @@ export class RabbitMQTrigger implements INodeType {
// the workflow gets deactivated and can so clean up. // the workflow gets deactivated and can so clean up.
async function closeFunction() { async function closeFunction() {
await channel.close(); await channel.close();
await channel.connection.close();
} }
// The "manualTriggerFunction" function gets called by n8n // The "manualTriggerFunction" function gets called by n8n