summary refs log tree commit diff
path: root/src/gateway
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-26 14:29:33 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-26 14:29:33 +1100
commitac7a178f88d96d12b322f091a43309d632eeb095 (patch)
tree41b18634ec0ba8f288bb0322f1283fc6f4c77d4f /src/gateway
parentDon't set default cdn endpoints. Null endpoints means to not update them in G... (diff)
downloadserver-ac7a178f88d96d12b322f091a43309d632eeb095.tar.xz
Fix SIGTERM handler not disconnecting gateway clients and leaving timeouts active
Diffstat (limited to 'src/gateway')
-rw-r--r--src/gateway/Server.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gateway/Server.ts b/src/gateway/Server.ts
index 81e4b7f4..3eec5c8f 100644
--- a/src/gateway/Server.ts
+++ b/src/gateway/Server.ts
@@ -82,7 +82,11 @@ export class Server {
 	}
 
 	async stop() {
-		closeDatabase();
-		this.server.close();
+		this.ws.clients.forEach((x) => x.close());
+		this.ws.close(() => {
+			this.server.close(() => {
+				closeDatabase();
+			});
+		});
 	}
 }