Skip to content

Commit 566fe4f

Browse files
author
Vikas Agarwal
committed
Aborting the process on any unhandled rejection to let the container know about this and restart the task
1 parent 667441e commit 566fe4f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

connect/connectNotificationServer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,5 +504,12 @@ if (config.ENABLE_EMAILS) {
504504
// notificationServer.logger.error('Notification server errored out');
505505
// });
506506

507+
508+
process.on('unhandledRejection', (reason, promise) => {
509+
console.log('Unhandled Rejection at:', promise, 'reason:', reason);
510+
// aborts the process to let the HA of the container to restart the task
511+
process.abort();
512+
});
513+
507514
// if no need to init database, then directly start the server:
508515
notificationServer.startKafkaConsumers();

0 commit comments

Comments
 (0)