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
5a7929dc
Commit
5a7929dc
authored
Feb 08, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address comments: watch.Until return private error errWatchClosed on channel closed
parent
51c7570a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
wait.go
staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go
+0
-3
until.go
staging/src/k8s.io/apimachinery/pkg/watch/until.go
+5
-1
No files found.
staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go
View file @
5a7929dc
...
@@ -129,9 +129,6 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration {
...
@@ -129,9 +129,6 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration {
// ErrWaitTimeout is returned when the condition exited without success.
// ErrWaitTimeout is returned when the condition exited without success.
var
ErrWaitTimeout
=
errors
.
New
(
"timed out waiting for the condition"
)
var
ErrWaitTimeout
=
errors
.
New
(
"timed out waiting for the condition"
)
// ErrChannelClosed is returned when the watch channel is closed.
var
ErrChannelClosed
=
errors
.
New
(
"watch channel closed"
)
// ConditionFunc returns true if the condition is satisfied, or an error
// ConditionFunc returns true if the condition is satisfied, or an error
// if the loop should be aborted.
// if the loop should be aborted.
type
ConditionFunc
func
()
(
done
bool
,
err
error
)
type
ConditionFunc
func
()
(
done
bool
,
err
error
)
...
...
staging/src/k8s.io/apimachinery/pkg/watch/until.go
View file @
5a7929dc
...
@@ -17,6 +17,7 @@ limitations under the License.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
watch
package
watch
import
(
import
(
"errors"
"time"
"time"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
...
@@ -28,6 +29,9 @@ import (
...
@@ -28,6 +29,9 @@ import (
// from false to true).
// from false to true).
type
ConditionFunc
func
(
event
Event
)
(
bool
,
error
)
type
ConditionFunc
func
(
event
Event
)
(
bool
,
error
)
// errWatchClosed is returned when the watch channel is closed before timeout in Until.
var
errWatchClosed
=
errors
.
New
(
"watch closed before Until timeout"
)
// Until reads items from the watch until each provided condition succeeds, and then returns the last watch
// Until reads items from the watch until each provided condition succeeds, and then returns the last watch
// encountered. The first condition that returns an error terminates the watch (and the event is also returned).
// encountered. The first condition that returns an error terminates the watch (and the event is also returned).
// If no event has been received, the returned event will be nil.
// If no event has been received, the returned event will be nil.
...
@@ -61,7 +65,7 @@ func Until(timeout time.Duration, watcher Interface, conditions ...ConditionFunc
...
@@ -61,7 +65,7 @@ func Until(timeout time.Duration, watcher Interface, conditions ...ConditionFunc
select
{
select
{
case
event
,
ok
:=
<-
ch
:
case
event
,
ok
:=
<-
ch
:
if
!
ok
{
if
!
ok
{
return
lastEvent
,
wait
.
ErrChannel
Closed
return
lastEvent
,
errWatch
Closed
}
}
lastEvent
=
&
event
lastEvent
=
&
event
...
...
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