Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0e10b2a8
Commit
0e10b2a8
authored
Apr 06, 2015
by
Rohit Jnagal
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6434 from alml/silent-watcher-close
Ignore errors after StreamWatcher is closed
parents
dbbfac3b
952ff24f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
iowatcher.go
pkg/watch/iowatcher.go
+11
-0
No files found.
pkg/watch/iowatcher.go
View file @
0e10b2a8
...
@@ -76,6 +76,13 @@ func (sw *StreamWatcher) Stop() {
...
@@ -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() {
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment