Skip to content

Commit

Permalink
fix: don't fetch logs for timed out services (#5870)
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 authored Sep 26, 2024
1 parent 4e2a0ee commit 9a112a5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
}
}

if watcher.State().PodStarted() || watcher.State().Completed() {
if watcher.State().PodStarted() || watcher.State().Completed() || opts.DisableFollow {
break
}
}
Expand All @@ -78,7 +78,7 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
}

// Handle the case when it has been complete without pod start
if !watcher.State().PodStarted() && watcher.State().Completed() {
if !watcher.State().PodStarted() && (watcher.State().Completed() || opts.DisableFollow) {
notifier.Align(watcher.State())
return
}
Expand Down Expand Up @@ -141,7 +141,7 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
}

// Determine if the container should be already accessible
if watcher.State().ContainerStarted(container) || watcher.State().Completed() {
if watcher.State().ContainerStarted(container) || watcher.State().Completed() || opts.DisableFollow {
break
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func WatchInstrumentedPod(parentCtx context.Context, clientSet kubernetes.Interf
// Wait until the Container is terminated
for ok := true; ok; _, ok = <-updatesCh {
// Determine if the container should be already stopped
if watcher.State().ContainerFinished(container) || watcher.State().Completed() {
if watcher.State().ContainerFinished(container) || watcher.State().Completed() || opts.DisableFollow {
break
}
}
Expand Down

0 comments on commit 9a112a5

Please sign in to comment.