mirror of https://github.com/k3s-io/k3s
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>k3s-v1.15.3
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 {
|
||||
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.
|
||||
if found, err := waitLogs(ctx, containerID, watcher, runtimeService); !found {
|
||||
|
|
Loading…
Reference in New Issue