summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 22:08:42 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-10 22:14:18 +1000
commitd20a24748cb0d9fe8161384cc8185b5baa87b453 (patch)
treeb7b603116361a461b7eefc475a39c95f4e2c4d5c
parentCheck if role icon was actually sent or if it's just an empty string (diff)
downloadserver-d20a24748cb0d9fe8161384cc8185b5baa87b453.tar.xz
Change bundle start to only start listening once DB and config have been loaded
-rw-r--r--bundle/src/Server.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts
index bc1d7cbc..651e8e64 100644
--- a/bundle/src/Server.ts
+++ b/bundle/src/Server.ts
@@ -33,7 +33,6 @@ process.on('SIGTERM', () => {
 //this is what has been added for the /stop API route
 
 async function main() {
-	server.listen(port);
 	await initDatabase();
 	await Config.init();
 	// only set endpointPublic, if not already set
@@ -84,7 +83,7 @@ async function main() {
 		app.use(Sentry.Handlers.requestHandler());
 		app.use(Sentry.Handlers.tracingHandler());
 	}
-	await Promise.all([api.start(), cdn.start(), gateway.start()]);
+
 	if (Config.get().sentry.enabled) {
 		app.use(Sentry.Handlers.errorHandler());
 		app.use(function onError(err: any, req: any, res: any, next: any) {
@@ -92,6 +91,8 @@ async function main() {
 			res.end(res.sentry + "\n");
 		});
 	}
+
+	await Promise.all([api.start(), cdn.start(), gateway.start()]);
 	console.log(`[Server] ${green(`listening on port ${bold(port)}`)}`);
 }