Skip to content

Commit

Permalink
move unhandledRejection to service's setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Sep 15, 2020
1 parent 72720df commit 47c5d5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/core/server/environment/environment_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class EnvironmentService {
this.configService.atPath<PidConfigType>(pidConfigDef.path).pipe(take(1)).toPromise(),
]);

// was present in the legacy `pid` file. Should be removed once we upgrade to node 16.
process.on('unhandledRejection', (reason) => {
this.log.warn(`Detected an unhandled Promise rejection.\n${reason}`);
});

await createDataFolder({ pathConfig, logger: this.log });
await writePidFile({ pidConfig, logger: this.log });

Expand Down
6 changes: 0 additions & 6 deletions src/core/server/environment/write_pid_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,4 @@ export const writePidFile = async ({
// resend SIGINT
process.kill(process.pid, 'SIGINT');
});

// was present in the legacy file, but should probably be removed as it seems
// handled by `kibana/src/setup_node_env/exit_on_warning.js`
process.on('unhandledRejection', function (reason) {
logger.warn(`Detected an unhandled Promise rejection.\n${reason}`);
});
};

0 comments on commit 47c5d5b

Please sign in to comment.