Split scheduled jobs so the working open-data fetch can run without the credential-less FTP/Harmonie jobs crash-looping the app

This commit is contained in:
b0txec
2026-08-23 10:34:44 +03:00
parent 82d9e0ba6e
commit 6ddfe73ca0
2 changed files with 21 additions and 2 deletions
+5
View File
@@ -6,6 +6,11 @@ POSTGRES_HOST=postgres
APP_BIND_ADDRESS=127.0.0.1
APP_PORT=9090
ENABLE_SCHEDULED_JOBS=true
# Gates the FTP station fetch and DMI Harmonie fetch specifically, separately
# from ENABLE_SCHEDULED_JOBS, since both require real credentials below.
# Leave false until those are real; both jobs throw on placeholder values,
# and would otherwise crash-loop the whole app rather than just fail quietly.
ENABLE_LEGACY_PROVIDER_JOBS=false
METEO_USER=aaa
METEO_PASSWORD=aaa
+16 -2
View File
@@ -55,11 +55,25 @@ object Main extends IOApp {
server <- Server.of(postgresService, dataService, fetchLvgmcService, warningService)
serverTask = server.run
scheduledTasks =
// Split from the legacy provider jobs below: parMapN cancels and fails
// every branch the moment any one of them throws, and the FTP/Harmonie
// paths currently point at placeholder credentials that always throw
// on first use. Without this split, enabling scheduled jobs at all
// would crash-loop the whole app (server included) roughly every few
// minutes rather than just start the real, working open-data fetch.
safeTasks =
if (sys.env.get("ENABLE_SCHEDULED_JOBS").exists(_.equalsIgnoreCase("false")))
IO.never[Unit]
else
(fetchStationsTask, fetchOpenDataStationsTask, cleanupTask, fetchGribTask).parMapN((_, _, _, _) => ())
(fetchOpenDataStationsTask, cleanupTask).parMapN((_, _) => ())
legacyProviderTasks =
if (sys.env.get("ENABLE_LEGACY_PROVIDER_JOBS").exists(_.equalsIgnoreCase("true")))
(fetchStationsTask, fetchGribTask).parMapN((_, _) => ())
else
IO.never[Unit]
scheduledTasks = (safeTasks, legacyProviderTasks).parMapN((_, _) => ())
exitCode <- (serverTask, scheduledTasks).parMapN((_, _) => ExitCode.Success)
} yield exitCode