diff options
author | Alan Pearce | 2024-04-10 11:33:01 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-10 11:33:01 +0200 |
commit | 8beec515146fc8cc323d9de722a405372801e1df (patch) | |
tree | 9af1125471e312f4d3ae0e1026fd2018d7edabc8 /src/sleep.ts | |
parent | 8de5eac6f52beba26d3ce6b5406dcf4ac35da641 (diff) | |
download | website-8beec515146fc8cc323d9de722a405372801e1df.tar.lz website-8beec515146fc8cc323d9de722a405372801e1df.tar.zst website-8beec515146fc8cc323d9de722a405372801e1df.zip |
fly: stop running in secondary regions if no meaningful requests
Diffstat (limited to 'src/sleep.ts')
-rw-r--r-- | src/sleep.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sleep.ts b/src/sleep.ts new file mode 100644 index 0000000..94d7547 --- /dev/null +++ b/src/sleep.ts @@ -0,0 +1,8 @@ +let sleepTimeout: Timer; + +export function keepAwake() { + if (sleepTimeout) clearTimeout(sleepTimeout); + sleepTimeout = setTimeout(function () { + process.exit(0); + }, 60_000); +} |