node-amqp-connection-manager icon indicating copy to clipboard operation
node-amqp-connection-manager copied to clipboard

Connection.close() hangs until reconnect attempt is completed.

Open MartinWickman opened this issue 5 years ago • 1 comments

When calling connection.close() on the wrapper and the rabbit connection is currently down, there is a 5 seconds delay before the connection dies. This makes the nodejs process hang until that happens.

My guess is this due to a reconnect setTimeout() pending. Close() should clear this timeout to allow the node process to exit in a timely manner.

MartinWickman avatar Sep 26 '19 14:09 MartinWickman

@MartinWickman did you find any solution for this ? @jwalton any insights you might be able to share ?

I can see this is caused because of this line:

https://github.com/jwalton/node-amqp-connection-manager/blob/master/src/AmqpConnectionManager.js#L207

and this line:

https://github.com/jwalton/node-amqp-connection-manager/blob/master/src/AmqpConnectionManager.js#L183

Where reconnectTimeInSeconds defaults to heartbeatIntervalInSeconds, which default to 5.

@CS-BTurner you are the one who did changes on this code last, any insights ?

enzoferey avatar Nov 29 '20 10:11 enzoferey