@seidor-cloud-produtos/orbit-backend-lib 2.0.124 → 2.0.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,6 +20,7 @@ class AmqpQueue {
|
|
|
20
20
|
static instance;
|
|
21
21
|
vHost;
|
|
22
22
|
connection;
|
|
23
|
+
isReconnecting = false;
|
|
23
24
|
messagesInMemory = [];
|
|
24
25
|
channels = new Map();
|
|
25
26
|
socketOptions;
|
|
@@ -34,7 +35,6 @@ class AmqpQueue {
|
|
|
34
35
|
setSocketOptions(socketOptions) {
|
|
35
36
|
this.socketOptions = {
|
|
36
37
|
maxStoredMessagesOnError: 500,
|
|
37
|
-
heartbeat: 60,
|
|
38
38
|
...(socketOptions || {}),
|
|
39
39
|
};
|
|
40
40
|
return this;
|
|
@@ -348,11 +348,16 @@ class AmqpQueue {
|
|
|
348
348
|
* reconectar, reativa consumidores e reenvia mensagens em memória.
|
|
349
349
|
*/
|
|
350
350
|
async treatReconnection(vHost) {
|
|
351
|
+
if (this.isReconnecting) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
this.isReconnecting = true;
|
|
351
355
|
this.logger.info('⛔ Connection Error!!');
|
|
352
356
|
this.logger.info(`🔄 Try connection to the vHost ${vHost}`);
|
|
353
357
|
await this.connect(vHost);
|
|
354
358
|
await this.reconnectionChannels();
|
|
355
359
|
await this.publishMessagesOfMemory();
|
|
360
|
+
this.isReconnecting = false;
|
|
356
361
|
}
|
|
357
362
|
/**
|
|
358
363
|
* Reinscreve todos os consumidores registrados anteriormente.
|