From 666ed5f46064ebaa570d7364bd88f6cb37ebe8db Mon Sep 17 00:00:00 2001 From: Vincent van Dam Date: Sun, 31 Oct 2021 22:30:04 +0100 Subject: [PATCH] Fix high cpu load when in crashloopbackoff state (#2) --- internal/backend/logs.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/backend/logs.go b/internal/backend/logs.go index b99d5e2..bd07216 100644 --- a/internal/backend/logs.go +++ b/internal/backend/logs.go @@ -57,18 +57,18 @@ func (in *instance) GetLogs(tainr *types.Container, follow bool, count int, stop // read log input (blocking read) buf := make([]byte, 255) n, err := stream.Read(buf) - if n == 0 { - if !follow { - break - } - continue - } if err == io.EOF { break } if err != nil { return err } + if n == 0 { + if !follow { + break + } + continue + } // write log to output if n, err = out.Write(buf[:n]); n == 0 || err != nil { break