amqp-connection-manager
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -54,2 +54,10 @@ "use strict"; | ||
this._closed = false; | ||
/** | ||
* Keep track of whether a disconnect event has been sent or not. The problem | ||
* is that if we've never connected, and we encounter an error, we want to | ||
* generate a "disconnect" event, even though we're not disconnected, otherwise | ||
* the caller will never know there was an error. So we can't just rely on | ||
* this._currentConnection. | ||
*/ | ||
this._disconnectSent = false; | ||
if (!urls && !options.findServers) { | ||
@@ -204,2 +212,3 @@ throw new Error('Must supply either `urls` or `findServers`'); | ||
this._currentConnection = undefined; | ||
this._disconnectSent = true; | ||
this.emit('disconnect', { err }); | ||
@@ -214,2 +223,3 @@ const handle = helpers_js_1.wait(this.reconnectTimeInSeconds * 1000); | ||
this._connectPromise = undefined; | ||
this._disconnectSent = false; | ||
this.emit('connect', { connection, url: originalUrl }); | ||
@@ -219,3 +229,6 @@ }); | ||
.catch((err) => { | ||
this.emit('disconnect', { err }); | ||
if (!this._disconnectSent) { | ||
this._disconnectSent = true; | ||
this.emit('disconnect', { err }); | ||
} | ||
// Connection failed... | ||
@@ -222,0 +235,0 @@ this._currentConnection = undefined; |
@@ -77,2 +77,10 @@ /// <reference types="node" /> | ||
private _urls?; | ||
/** | ||
* Keep track of whether a disconnect event has been sent or not. The problem | ||
* is that if we've never connected, and we encounter an error, we want to | ||
* generate a "disconnect" event, even though we're not disconnected, otherwise | ||
* the caller will never know there was an error. So we can't just rely on | ||
* this._currentConnection. | ||
*/ | ||
private _disconnectSent; | ||
connectionOptions: AmpqConnectionOptions | undefined; | ||
@@ -79,0 +87,0 @@ heartbeatIntervalInSeconds: number; |
@@ -49,2 +49,10 @@ import amqp from 'amqplib'; | ||
this._closed = false; | ||
/** | ||
* Keep track of whether a disconnect event has been sent or not. The problem | ||
* is that if we've never connected, and we encounter an error, we want to | ||
* generate a "disconnect" event, even though we're not disconnected, otherwise | ||
* the caller will never know there was an error. So we can't just rely on | ||
* this._currentConnection. | ||
*/ | ||
this._disconnectSent = false; | ||
if (!urls && !options.findServers) { | ||
@@ -199,2 +207,3 @@ throw new Error('Must supply either `urls` or `findServers`'); | ||
this._currentConnection = undefined; | ||
this._disconnectSent = true; | ||
this.emit('disconnect', { err }); | ||
@@ -209,2 +218,3 @@ const handle = wait(this.reconnectTimeInSeconds * 1000); | ||
this._connectPromise = undefined; | ||
this._disconnectSent = false; | ||
this.emit('connect', { connection, url: originalUrl }); | ||
@@ -214,3 +224,6 @@ }); | ||
.catch((err) => { | ||
this.emit('disconnect', { err }); | ||
if (!this._disconnectSent) { | ||
this._disconnectSent = true; | ||
this.emit('disconnect', { err }); | ||
} | ||
// Connection failed... | ||
@@ -217,0 +230,0 @@ this._currentConnection = undefined; |
{ | ||
"name": "amqp-connection-manager", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Auto-reconnect and round robin support for amqplib.", | ||
@@ -5,0 +5,0 @@ "module": "./dist/esm/index.js", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
111082
1862
0