Is there a way to handle SIGTERM event in TSED lifecycle hook (Graceful Shutdown event) #2586
ashprojects
started this conversation in
General
Replies: 1 comment 5 replies
-
Hello @ashprojects If you generate a project using CLI, the index.ts will contains all of your needs. async function bootstrap() {
try {
const platform = await PlatformExpress.bootstrap(Server);
await platform.listen();
process.on("SIGINT", () => {
platform.stop();
});
} catch (error) {
$log.error({event: "SERVER_BOOTSTRAP_ERROR", message: error.message, stack: error.stack});
}
}
bootstrap(); Also, I just that all of explanation are is the hook documentation. Maybe something is not clear, or you have missed the first example in the doc. See you |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We deploy our code to ECS containers. ECS would give us SIGTERM to have a graceful shutdown where we do following things:
In node we can easily catch SIGTERM with this:
I read about Custom Event in Injector Service here: https://tsed.io/docs/hooks.html#subscribe-to-a-hook
But can't find module-emitter package anywhere. Currently on v6.101
It would be easy if I could raise an event (ex $onGracefulShutdown) and each corresponding service would implement and take action accordingly.
Beta Was this translation helpful? Give feedback.
All reactions