Skip to content

Commit

Permalink
add watchdog feature flag check before checking for task installation (
Browse files Browse the repository at this point in the history
  • Loading branch information
zackattack01 authored Jan 6, 2025
1 parent 27e024e commit 3308194
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ee/watchdog/controller_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ func (wc *WatchdogController) publishLogs(ctx context.Context) {
return
}

// don't bother processing further unless watchdog is enabled.
// note that this means if you manually install watchdog via CLI, logs
// will not be published unless you have the corresponding feature flag enabled
if !wc.knapsack.LauncherWatchdogEnabled() {
return
}

// note that there is a small window here where there could be pending logs before the watchdog task is removed -
// there is no harm in leaving them and we could recover these with the original timestamps if we ever needed.
// to avoid endlessly re-processing empty logs while we are disabled, we accept this possibility and exit early here
Expand Down
1 change: 1 addition & 0 deletions ee/watchdog/controller_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestInterrupt_Multiple(t *testing.T) {
mockKnapsack.On("Slogger").Return(testSlogger)
mockKnapsack.On("Identifier").Return("kolide-k2")
mockKnapsack.On("KolideServerURL").Return("k2device.kolide.com")
mockKnapsack.On("LauncherWatchdogEnabled").Return(false).Maybe()

controller, _ := NewController(context.TODO(), mockKnapsack, "")

Expand Down

0 comments on commit 3308194

Please sign in to comment.