mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 00:57:27 +00:00
Do not log net.errClosing error when StreamWatcher is stopping.
This commit is contained in:
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.
|
// receive reads result from the decoder in a loop and sends down the result channel.
|
||||||
func (sw *StreamWatcher) receive() {
|
func (sw *StreamWatcher) receive() {
|
||||||
defer close(sw.result)
|
defer close(sw.result)
|
||||||
@ -84,6 +91,10 @@ func (sw *StreamWatcher) receive() {
|
|||||||
for {
|
for {
|
||||||
action, obj, err := sw.source.Decode()
|
action, obj, err := sw.source.Decode()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Ignore expected error.
|
||||||
|
if sw.stopping() {
|
||||||
|
return
|
||||||
|
}
|
||||||
switch err {
|
switch err {
|
||||||
case io.EOF:
|
case io.EOF:
|
||||||
// watch closed normally
|
// watch closed normally
|
||||||
|
Loading…
Reference in New Issue
Block a user