Keep process alive reliably with unref interval in waitForever
This commit is contained in:
@@ -384,8 +384,11 @@ async function startWebhook(
|
||||
}
|
||||
|
||||
function waitForever() {
|
||||
// Keep event loop alive via an unref'ed interval plus a pending promise.
|
||||
const interval = setInterval(() => {}, 1_000_000);
|
||||
interval.unref();
|
||||
return new Promise<void>(() => {
|
||||
/* never resolve to keep process alive */
|
||||
/* never resolve */
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user