| 338 | } |
| 339 | |
| 340 | caughtExceptionShutdown() { |
| 341 | if (!this.cluster) { |
| 342 | process.exit(1); |
| 343 | } |
| 344 | logger.error('shutdown of worker due to exception', { |
| 345 | workerId: this.worker ? this.worker.id : undefined, |
| 346 | workerPid: this.worker ? this.worker.process.pid : undefined, |
| 347 | }); |
| 348 | // Will close all servers, cause disconnect event on primary and kill |
| 349 | // worker process with 'SIGTERM'. |
| 350 | if (this.worker) { |
| 351 | this.worker.kill(); |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | startServer(listenOn, port, routeRequest) { |
| 356 | if (listenOn.length > 0) { |