()
| 118 | } |
| 119 | |
| 120 | function awaitHardStop() { |
| 121 | const timeout = process.env.SHUTDOWN_TIMEOUT |
| 122 | ? parseInt(process.env.SHUTDOWN_TIMEOUT) |
| 123 | : 1000 * 30; |
| 124 | return setTimeout(() => { |
| 125 | console.error( |
| 126 | `Process did not terminate within ${timeout}ms. Stopping now!`, |
| 127 | ); |
| 128 | process.nextTick(() => process.exit(1)); |
| 129 | }, timeout); |
| 130 | } |
| 131 | |
| 132 | // handle errors & rejections |
| 133 | process.on("uncaughtException", (error) => { |