Skip to content

Commit ee989d2

Browse files
authored
fix: check isShuttingDown before doConnect (#23)
1 parent 5459bc0 commit ee989d2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/service_amqp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = class Amqp extends Component.mixin(AsyncEmitter) {
1212
this.logger = logger;
1313
this._connection;
1414
this._initializing = false;
15+
this._isShuttingDown = false;
1516
this.serviceSub = null;
1617
this.serviceSubQueue = null;
1718
this.signals = ["SIGINT", "SIGTERM", "SIGQUIT"];
@@ -27,6 +28,7 @@ module.exports = class Amqp extends Component.mixin(AsyncEmitter) {
2728

2829
*doConnect() {
2930
if (this._initializing) return;
31+
if (this._isShuttingDown) return;
3032
this._initializing = true;
3133
let {
3234
secure,
@@ -82,6 +84,7 @@ module.exports = class Amqp extends Component.mixin(AsyncEmitter) {
8284

8385
*stop() {
8486
try {
87+
this._isShuttingDown = true;
8588
this.logger.info("Shutting down rabbitmq plugin...");
8689
this._connection.close();
8790
} catch (e) {

0 commit comments

Comments
 (0)