Skip to content

Commit ca24ea1

Browse files
author
Marvel Mathew
committed
Don't delete subscription if fanout is disabled
1 parent 1804860 commit ca24ea1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,18 @@ class Subscriber extends events.EventEmitter {
126126
function removeListeners() {
127127
subscription.removeListener('message', onMessage);
128128
subscription.removeListener('error', onError);
129-
process.removeListener('SIGTERM', deleteSubscription);
130-
process.removeListener('SIGINT', deleteSubscription);
129+
130+
if (!this.disableFanOut) {
131+
process.removeListener('SIGTERM', deleteSubscription);
132+
process.removeListener('SIGINT', deleteSubscription);
133+
}
131134
}
132135

133136
// Handle termination, delete the subscription (require graceful shutdowm)
134-
process.on('SIGTERM', deleteSubscription);
135-
process.on('SIGINT', deleteSubscription);
137+
if (!this.disableFanOut) {
138+
process.on('SIGTERM', deleteSubscription);
139+
process.on('SIGINT', deleteSubscription);
140+
}
136141

137142
// Bind the subscription
138143
subscription.on('message', onMessage);

0 commit comments

Comments
 (0)