Skip to content

Commit 6dd9b93

Browse files
committed
fix(api): delay pm2 start until server has booted
prior to this, pm2 would mark unraid-api as started as soon as the node process started. The Nest server wouldn't finish booting until later. This meant unraid-api could "start", but the webgui wouldn't be fully functional because it couldn't connect to the api yet. This was a sucky user & dev experience.
1 parent 70d649c commit 6dd9b93

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

api/ecosystem.config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"cwd": "/usr/local/unraid-api",
88
"log": "/var/log/unraid-api/unraid-api.log",
99
"exec_mode": "fork",
10+
"wait_ready": true,
11+
"listen_timeout": 30000,
1012
"ignore_watch": [
1113
"node_modules",
1214
"src",

api/src/unraid-api/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export async function bootstrapNestServer(): Promise<NestFastifyApplication> {
4848
const result = await server.listen({ port: parseInt(PORT), host: '0.0.0.0' });
4949
console.log('Server listening on %s', result);
5050
}
51-
51+
if (process.send) {
52+
process.send('ready');
53+
}
5254
apiLogger.info('Nest Server is now listening');
5355

5456
return app;

0 commit comments

Comments
 (0)