diff --git a/lib/transport.js b/lib/transport.js index 4112572..dbdef75 100644 --- a/lib/transport.js +++ b/lib/transport.js @@ -1,4 +1,5 @@ const MODULE_NAME = 'TRANSPORT'; +const SLEEP_BEFORE_TERMINATE_ON_ERROR_MS = 5 * 1000; const bot = require("simple-xmpp"); const config = require('komodo-sdk/config'); @@ -62,8 +63,13 @@ bot.on('error', (err) => { }); if (!config.do_not_terminate_on_error) { - logger.warn(`${MODULE_NAME} BA6C0C55: Terminating on error`); - process.exit(1); + logger.warn(`${MODULE_NAME} BA6C0C55: Terminating on error`, { + millisecondSleepBeforeTerminate: SLEEP_BEFORE_TERMINATE_ON_ERROR_MS, + }); + + setTimeout(() => { + process.exit(1); + }, SLEEP_BEFORE_TERMINATE_ON_ERROR_MS) } });