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
268dc570
Unverified
Commit
268dc570
authored
Jun 01, 2018
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add wait.PollImmediateUntil
parent
e3a41044
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
wait.go
staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go
+21
-1
No files found.
staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go
View file @
268dc570
...
...
@@ -284,12 +284,32 @@ func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) erro
// PollUntil tries a condition func until it returns true, an error or stopCh is
// closed.
//
// PolUntil always waits interval before the first run of 'condition'.
// Pol
l
Until always waits interval before the first run of 'condition'.
// 'condition' will always be invoked at least once.
func
PollUntil
(
interval
time
.
Duration
,
condition
ConditionFunc
,
stopCh
<-
chan
struct
{})
error
{
return
WaitFor
(
poller
(
interval
,
0
),
condition
,
stopCh
)
}
// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
//
// PollImmediateUntil runs the 'condition' before waiting for the interval.
// 'condition' will always be invoked at least once.
func
PollImmediateUntil
(
interval
time
.
Duration
,
condition
ConditionFunc
,
stopCh
<-
chan
struct
{})
error
{
done
,
err
:=
condition
()
if
err
!=
nil
{
return
err
}
if
done
{
return
nil
}
select
{
case
<-
stopCh
:
return
ErrWaitTimeout
default
:
return
PollUntil
(
interval
,
condition
,
stopCh
)
}
}
// WaitFunc creates a channel that receives an item every time a test
// should be executed and is closed when the last test should be invoked.
type
WaitFunc
func
(
done
<-
chan
struct
{})
<-
chan
struct
{}
...
...
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