Skip to content

Commit 8dca5c8

Browse files
Merge pull request #17 from kata-ai/feature/reconnect-tested
works
2 parents 3062201 + 0ff0698 commit 8dca5c8

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

lib/service_amqp.js

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module.exports = class Amqp extends Component.mixin(AsyncEmitter) {
1212
this.logger = logger;
1313
this._connection;
1414
this._initializing = false;
15+
this.serviceSub = null;
16+
this.serviceSubQueue = null;
1517
}
1618

1719
initialize() {
@@ -57,6 +59,8 @@ module.exports = class Amqp extends Component.mixin(AsyncEmitter) {
5759
this.logger.warn("Failed to connect to rmq.", e);
5860
yield sleep(3000);
5961
this.logger.info("Attempting to reconnect to rmq.");
62+
this.serviceSub._initializing = false;
63+
this.serviceSubQueue._initializing = false;
6064

6165
yield this.doConnect();
6266
}

lib/service_sub_queue_rabbit.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ServiceSubRabbit extends ServiceSubQueue {
1313
this.logger = logger;
1414
this.injector = injector;
1515
this.amqp = amqp;
16+
this.amqp.serviceSubQueue = this;
1617

1718
this.SERVICE_NAME = config.default("name", "unnamed-service");
1819
this.VERSION = pack.version;

lib/service_sub_rabbit.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ServiceSubRabbit extends ServiceSub {
1414
this.logger = logger;
1515
this.injector = injector;
1616
this.amqp = amqp;
17+
this.amqp.serviceSub = this;
1718
this.servicePubRabbit = servicePubRabbit;
1819

1920
this.SERVICE_NAME = config.default("name", "unnamed-service");

0 commit comments

Comments
 (0)