diff --git a/src/AmqpConnectionManager.js b/src/AmqpConnectionManager.js index 36c0543..9a31dd1 100644 --- a/src/AmqpConnectionManager.js +++ b/src/AmqpConnectionManager.js @@ -208,8 +208,12 @@ export default class AmqpConnectionManager extends EventEmitter { this._currentConnection = null; this._connectPromise = null; - // TODO: Probably want to try right away here, especially if there are multiple brokers to try... - const handle = wait(this.reconnectTimeInSeconds * 1000); + let handle; + if (err.name === 'OperationalError' && err.message === 'connect ETIMEDOUT') { + handle = wait(0); + } else { + handle = wait(this.reconnectTimeInSeconds * 1000); + } this._cancelRetriesHandler = handle.cancel; return handle.promise().then(() => this._connect());