Don't close the stream (#1844)

This commit is contained in:
Asim Aslam 2020-07-15 14:44:31 +01:00 committed by GitHub
parent 68927e875b
commit 7d41c2224e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -392,7 +392,6 @@ func (k *kubeStream) Stop() error {
return nil return nil
default: default:
close(k.stop) close(k.stop)
close(k.stream)
} }
return nil return nil
} }

View File

@ -53,7 +53,11 @@ func (k *klog) podLogStream(podName string, stream *kubeStream) error {
record := runtime.LogRecord{ record := runtime.LogRecord{
Message: s.Text(), Message: s.Text(),
} }
stream.stream <- record select {
case stream.stream <- record:
case <-stream.stop:
return stream.Error()
}
} else { } else {
// TODO: is there a blocking call // TODO: is there a blocking call
// rather than a sleep loop? // rather than a sleep loop?