Skip to content

Commit

Permalink
Don't error if log reconnection fails due to context canceled (#875)
Browse files Browse the repository at this point in the history
Co-authored-by: AaronH88 <[email protected]>
  • Loading branch information
willthames and AaronH88 authored Oct 13, 2023
1 parent 5c4dfac commit 63ee265
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/workceptor/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ func (kw *kubeUnit) kubeLoggingWithReconnect(streamWait *sync.WaitGroup, stdout
for *stdinErr == nil { // check between every line read to see if we need to stop reading
line, err := streamReader.ReadString('\n')
if err != nil {
if kw.ctx.Err() == context.Canceled {
kw.Info(
"Context was canceled while reading logs for pod %s/%s. Assuming pod has finished",
podNamespace,
podName)

return
}
kw.Info(
"Detected Error: %s for pod %s/%s. Will retry %d more times.",
err,
Expand Down

0 comments on commit 63ee265

Please sign in to comment.