Be able to specify timeout
everhardt opened this issue · 2 comments
everhardt commented
It takes a very long time before a connection attempt times out. Right now there's no way to configure a connect timeout in the AMQPClient
constructor or the .connect()
function, which would be great to have.
For now, I wrote the following workaround:
const connectionPromise = amqp.connect();
amqp.socket?.setTimeout(5000);
connection = await new Promise((resolve, reject) => {
amqp.socket?.on('timeout', () => {
amqp.socket?.destroy();
reject(new DestinationError('Timeout hit'));
});
connectionPromise.then(resolve).catch(reject);
});
dentarg commented
Pretty sure #78 improved on this, are you able to check @everhardt? Using the heartbeat
parameter you can control the timeout