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

@@ -95,8 +95,9 @@ func (s *svc) Logs(service *runtime.Service, options ...runtime.LogsOption) (run
type serviceLogStream struct {
service string
stream chan runtime.LogRecord
stop chan bool
err error
sync.Mutex
stop chan bool
err error
}
func (l *serviceLogStream) Error() error {
@@ -108,6 +109,8 @@ func (l *serviceLogStream) Chan() chan runtime.LogRecord {
}
func (l *serviceLogStream) Stop() error {
l.Lock()
defer l.Unlock()
select {
case <-l.stop:
return nil