mirror of https://github.com/k3s-io/k3s
Do not log net.errClosing error when StreamWatcher is stopping.
parent
dbd7b186a0
commit
952ff24f0b
|
@ -76,6 +76,13 @@ func (sw *StreamWatcher) Stop() {
|
|||
}
|
||||
}
|
||||
|
||||
// stopping returns true if Stop() was called previously.
|
||||
func (sw *StreamWatcher) stopping() bool {
|
||||
sw.Lock()
|
||||
defer sw.Unlock()
|
||||
return sw.stopped
|
||||
}
|
||||
|
||||
// receive reads result from the decoder in a loop and sends down the result channel.
|
||||
func (sw *StreamWatcher) receive() {
|
||||
defer close(sw.result)
|
||||
|
@ -84,6 +91,10 @@ func (sw *StreamWatcher) receive() {
|
|||
for {
|
||||
action, obj, err := sw.source.Decode()
|
||||
if err != nil {
|
||||
// Ignore expected error.
|
||||
if sw.stopping() {
|
||||
return
|
||||
}
|
||||
switch err {
|
||||
case io.EOF:
|
||||
// watch closed normally
|
||||
|
|
Loading…
Reference in New Issue