Skip to content

Commit 737cf44

Browse files
author
Team Coding Agent 1
committed
fix: persist watchdog_enabled setting from runtime_settings.json
The watchdog_enabled setting was not being applied from the runtime_settings.json file because the code was checking if WatchDogIdle or WatchDogBusy were set via env vars, but not checking if WatchDog itself was set via env vars. This caused the setting to be ignored when the user enabled watchdog through the UI because: 1. The file was written correctly with watchdog_enabled=true 2. But on reload, the code checked !envWatchdogIdle && !envWatchdogBusy 3. This condition didn't account for the main WatchDog flag 4. So the setting from file was never applied Fix: - Add envWatchdog check to track if WatchDog was set via env var - Apply WatchdogEnabled from file when not set via env - Also disable WatchDogIdle and WatchDogBusy when watchdog is disabled Fixes #9125
1 parent d3f629f commit 737cf44

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

core/application/config_file_watcher.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ func readRuntimeSettingsJson(startupAppConfig config.ApplicationConfig) fileHand
197197
envWatchdogBusy := appConfig.WatchDogBusy == startupAppConfig.WatchDogBusy
198198
envWatchdogIdleTimeout := appConfig.WatchDogIdleTimeout == startupAppConfig.WatchDogIdleTimeout
199199
envWatchdogBusyTimeout := appConfig.WatchDogBusyTimeout == startupAppConfig.WatchDogBusyTimeout
200+
envWatchdog := appConfig.WatchDog == startupAppConfig.WatchDog
200201
envSingleBackend := appConfig.SingleBackend == startupAppConfig.SingleBackend
201202
envMaxActiveBackends := appConfig.MaxActiveBackends == startupAppConfig.MaxActiveBackends
202203
envParallelRequests := appConfig.ParallelBackendRequests == startupAppConfig.ParallelBackendRequests
@@ -352,10 +353,12 @@ func readRuntimeSettingsJson(startupAppConfig config.ApplicationConfig) fileHand
352353
appConfig.AgentJobRetentionDays = *settings.AgentJobRetentionDays
353354
}
354355

355-
// If watchdog is enabled via file but not via env, ensure WatchDog flag is set
356-
if !envWatchdogIdle && !envWatchdogBusy {
357-
if settings.WatchdogEnabled != nil && *settings.WatchdogEnabled {
358-
appConfig.WatchDog = true
356+
if settings.WatchdogEnabled != nil && !envWatchdog {
357+
appConfig.WatchDog = *settings.WatchdogEnabled
358+
// If watchdog is being disabled, also disable the sub-features
359+
if !appConfig.WatchDog {
360+
appConfig.WatchDogIdle = false
361+
appConfig.WatchDogBusy = false
359362
}
360363
}
361364
}

0 commit comments

Comments
 (0)