mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
fix(workers): always log startup and exit reason (#2717)
Deep-forecast and simulation workers exited silently on idle, making it impossible to distinguish "no tasks" from "crashed on import" in Railway logs. Now logs Starting/Exiting with status on every run, and FATAL with error message on uncaught exceptions.
This commit is contained in:
@@ -8,7 +8,11 @@ loadEnvFile(import.meta.url);
|
||||
const once = process.argv.includes('--once');
|
||||
const runId = process.argv.find((arg) => arg.startsWith('--run-id='))?.split('=')[1] || '';
|
||||
|
||||
const result = await runDeepForecastWorker({ once, runId });
|
||||
if (once && result?.status && result.status !== 'idle') {
|
||||
console.log(` [DeepForecast] ${result.status}`);
|
||||
try {
|
||||
console.log(`[DeepForecast] Starting (once=${once}, pid=${process.pid})`);
|
||||
const result = await runDeepForecastWorker({ once, runId });
|
||||
console.log(`[DeepForecast] Exiting: ${result?.status || 'unknown'}`);
|
||||
} catch (err) {
|
||||
console.error(`[DeepForecast] FATAL: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,11 @@ loadEnvFile(import.meta.url);
|
||||
const once = process.argv.includes('--once');
|
||||
const runId = process.argv.find((arg) => arg.startsWith('--run-id='))?.split('=')[1] || '';
|
||||
|
||||
const result = await runSimulationWorker({ once, runId });
|
||||
if (once && result?.status && result.status !== 'idle') {
|
||||
console.log(` [Simulation] ${result.status}`);
|
||||
try {
|
||||
console.log(`[Simulation] Starting (once=${once}, pid=${process.pid})`);
|
||||
const result = await runSimulationWorker({ once, runId });
|
||||
console.log(`[Simulation] Exiting: ${result?.status || 'unknown'}`);
|
||||
} catch (err) {
|
||||
console.error(`[Simulation] FATAL: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user