Skip to content

Commit f12ad7d

Browse files
fix calling a function that does not exists on garbage collector sigterm event
Issue: BB-752
1 parent 02b64a1 commit f12ad7d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

extensions/gc/GarbageCollector.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,17 @@ class GarbageCollector extends EventEmitter {
167167
}
168168

169169
/**
170-
* Close the lifecycle consumer
170+
* Close the garbage collector consumer
171171
* @param {function} cb - callback function
172172
* @return {undefined}
173173
*/
174174
close(cb) {
175175
this._logger.debug('closing garbage collector consumer');
176-
this._consumer.close(cb);
176+
if (this._consumer) {
177+
this._consumer.close(cb);
178+
} else {
179+
cb();
180+
}
177181
}
178182

179183
processKafkaEntry(kafkaEntry, done) {

extensions/gc/service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ initAndStart();
100100

101101
process.on('SIGTERM', () => {
102102
logger.info('received SIGTERM, exiting');
103-
garbageCollector.stop(() => {
103+
garbageCollector.close(() => {
104104
process.exit(0);
105105
});
106106
});

0 commit comments

Comments
 (0)