- if containerFinished {
- // If the caller specified a container request
- // UUID and the container we were watching has
- // been replaced by a new one, start watching
- // logs from the new one. Otherwise, we're
- // done.
- if target == ctrUUID {
- // caller specified container UUID
- return nil
- }
- newUUID, err := resolveToContainerUUID(rpcconn, target)
- if err != nil {
- return err
- }
- if newUUID == ctrUUID {
- // no further attempts
- return nil
- }
- ctrUUID = newUUID
- containerFinished = false
+ if displayingUUID != cr.ContainerUUID {
+ // A different container had already been
+ // assigned when we started fetching the
+ // latest batch of logs. We can now safely
+ // start displaying logs from the new
+ // container, without missing any of the
+ // previous container's logs.
+ displayingUUID = cr.ContainerUUID