Close relay sockets on shutdown so the server exits on SIGTERM
This commit is contained in:
parent
b4254ebe23
commit
2cda3acedb
1 changed files with 2 additions and 0 deletions
|
|
@ -24,6 +24,8 @@ const DEAD_RELAY_TTL = 5 * 60_000;
|
||||||
const CACHE_MAX = 2000;
|
const CACHE_MAX = 2000;
|
||||||
|
|
||||||
const pool = new SimplePool();
|
const pool = new SimplePool();
|
||||||
|
// Open relay sockets keep the process alive after SIGTERM until systemd kills it
|
||||||
|
process.on("sveltekit:shutdown", () => pool.destroy());
|
||||||
type Entry = { at: number; result: Promise<Event[]>; refreshing: boolean };
|
type Entry = { at: number; result: Promise<Event[]>; refreshing: boolean };
|
||||||
const cache = new Map<string, Entry>();
|
const cache = new Map<string, Entry>();
|
||||||
// Relays that failed to connect are skipped for a while, so a dead profile
|
// Relays that failed to connect are skipped for a while, so a dead profile
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue