INNER CODE UNIT · TypeScript
shutdown
pamgarcia1993/robinhood-lp-bot · src/index.ts:19
const shutdown = (sig: string) => {
log.info(`${sig} — matiin bersih…`);
stop();
release();
// give in-flight Telegram calls a beat, then exit
setTimeout(() => process.exit(0), 500);
};
process.on("SIGINT", () => shutdown("SIGINT"));
process.on("SIGTERM", () => shutdown("SIGTERM"));
process.on("uncaughtException", (e) => log.error("uncaughtException", e));
process.on("unhandledRejection", (e) => log.error("unhandledRejection", e));
await run();
release();
}
main().catch((e) => {
log.error(String(e?.message ?? e));