fix(server): refine error handling and PM2 connection logic
Deploy to Raspberry Pi / deploy (push) Canceled after 1m16s

- Reduced the maximum restarts for PM2 processes from 20 to 8 and added a restart delay of 2000ms for better stability.
- Improved error handling during server startup and PM2 connection, ensuring clearer logging and graceful exits on failure.
- Introduced a utility function to filter out PM2 metadata from environment variables, preventing conflicts during process management.
This commit is contained in:
2026-08-23 08:45:26 +07:00
parent 69312c9080
commit dd98421b08
3 changed files with 68 additions and 20 deletions
+2 -1
View File
@@ -48,7 +48,8 @@ module.exports = {
instances: 1,
exec_mode: "fork",
autorestart: true,
max_restarts: 20,
max_restarts: 8,
restart_delay: 2000,
env: {
...env,
JFLOW_CONTROL_PORT: env.JFLOW_CONTROL_PORT ?? "8600",