INNER CODE UNIT · TypeScript
main
pamgarcia1993/robinhood-lp-bot · src/index.ts:15
async function main(): Promise<void> {
assertSecrets();
const release = acquireLock();
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();