chore: Improve graceful server shutdown (#4625)

* chore: Improve graceful server shutdown

* Replace node timers with custom promise timeout
This commit is contained in:
Tom Moor
2022-12-31 21:56:27 +00:00
committed by GitHub
parent ad9525bfa3
commit 05a4f050bb
16 changed files with 160 additions and 20 deletions

8
server/utils/timers.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* Returns a promise that resolves after a specified number of milliseconds.
*
* @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
*/
export function timeout(ms = 1) {
return new Promise((resolve) => setTimeout(resolve, ms));
}