mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
kubelet: read immediately after creating the watcher
if some events happen between the Read and while we set the watcher, we might miss them. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
615c491040
commit
2c30eee92f
@ -316,6 +316,9 @@ func ReadLogs(ctx context.Context, path, containerID string, opts *LogOptions, r
|
|||||||
if err := watcher.Add(f.Name()); err != nil {
|
if err := watcher.Add(f.Name()); err != nil {
|
||||||
return fmt.Errorf("failed to watch file %q: %v", f.Name(), err)
|
return fmt.Errorf("failed to watch file %q: %v", f.Name(), err)
|
||||||
}
|
}
|
||||||
|
// If we just created the watcher, try again to read as we might have missed
|
||||||
|
// the event.
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
// Wait until the next log change.
|
// Wait until the next log change.
|
||||||
if found, err := waitLogs(ctx, containerID, watcher, runtimeService); !found {
|
if found, err := waitLogs(ctx, containerID, watcher, runtimeService); !found {
|
||||||
|
Loading…
Reference in New Issue
Block a user