fix(AMQP Trigger Node): Properly close connection after manual test step (#8396)

This commit is contained in:
Michael Kret 2024-01-19 13:39:18 +02:00 committed by GitHub
parent daba5bb250
commit 2c14371481
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -48,16 +48,18 @@ export class AmqpTrigger implements INodeType {
name: 'clientname', name: 'clientname',
type: 'string', type: 'string',
default: '', default: '',
placeholder: 'for durable/persistent topic subscriptions, example: "n8n"', placeholder: 'e.g. n8n',
description: 'Leave empty for non-durable topic subscriptions or queues', description: 'Leave empty for non-durable topic subscriptions or queues',
hint: 'for durable/persistent topic subscriptions',
}, },
{ {
displayName: 'Subscription', displayName: 'Subscription',
name: 'subscription', name: 'subscription',
type: 'string', type: 'string',
default: '', default: '',
placeholder: 'for durable/persistent topic subscriptions, example: "order-worker"', placeholder: 'e.g. order-worker',
description: 'Leave empty for non-durable topic subscriptions or queues', description: 'Leave empty for non-durable topic subscriptions or queues',
hint: 'for durable/persistent topic subscriptions',
}, },
{ {
displayName: 'Options', displayName: 'Options',
@ -270,6 +272,10 @@ export class AmqpTrigger implements INodeType {
const manualTriggerFunction = async () => { const manualTriggerFunction = async () => {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const timeoutHandler = setTimeout(() => { const timeoutHandler = setTimeout(() => {
container.removeAllListeners('receiver_open');
container.removeAllListeners('message');
connection.close();
reject( reject(
new Error( new Error(
'Aborted, no message received within 30secs. This 30sec timeout is only set for "manually triggered execution". Active Workflows will listen indefinitely.', 'Aborted, no message received within 30secs. This 30sec timeout is only set for "manually triggered execution". Active Workflows will listen indefinitely.',