1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-07-12 22:41:07 +02:00

Stop LogStream if there is an error in k8s pod log streaming (#1469)

* Stop LogStream if there is an error in k8s pod log streaming

* Locking stream Stops

* PR comment
This commit is contained in:
Janos Dobronszki
2020-04-02 13:16:35 +02:00
committed by GitHub
parent 0241197c6a
commit 2cafa289b6
5 changed files with 18 additions and 4 deletions

View File

@ -330,6 +330,7 @@ type kubeStream struct {
// the k8s log stream
stream chan runtime.LogRecord
// the stop chan
sync.Mutex
stop chan bool
err error
}
@ -343,6 +344,8 @@ func (k *kubeStream) Chan() chan runtime.LogRecord {
}
func (k *kubeStream) Stop() error {
k.Lock()
defer k.Unlock()
select {
case <-k.stop:
return nil

View File

@ -32,6 +32,7 @@ func (k *klog) podLogStream(podName string, stream *kubeStream) error {
if err != nil {
stream.err = err
stream.Stop()
return err
}