Commit 3a0d6c1c9e1680cfc134bb80e4e14bae1206b9ab
1 parent
685ba2f25b
Exists in
master
Add SLEEP_BEFORE_TERMINATE_ON_ERROR_MS
Showing 1 changed file with 8 additions and 2 deletions Side-by-side Diff
lib/transport.js
1 | 1 | const MODULE_NAME = 'TRANSPORT'; |
2 | +const SLEEP_BEFORE_TERMINATE_ON_ERROR_MS = 5 * 1000; | |
2 | 3 | |
3 | 4 | const bot = require("simple-xmpp"); |
4 | 5 | const config = require('komodo-sdk/config'); |
... | ... | @@ -62,8 +63,13 @@ bot.on('error', (err) => { |
62 | 63 | }); |
63 | 64 | |
64 | 65 | if (!config.do_not_terminate_on_error) { |
65 | - logger.warn(`${MODULE_NAME} BA6C0C55: Terminating on error`); | |
66 | - process.exit(1); | |
66 | + logger.warn(`${MODULE_NAME} BA6C0C55: Terminating on error`, { | |
67 | + millisecondSleepBeforeTerminate: SLEEP_BEFORE_TERMINATE_ON_ERROR_MS, | |
68 | + }); | |
69 | + | |
70 | + setTimeout(() => { | |
71 | + process.exit(1); | |
72 | + }, SLEEP_BEFORE_TERMINATE_ON_ERROR_MS) | |
67 | 73 | } |
68 | 74 | }); |
69 | 75 |