mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-28 16:07:29 +00:00
Document blocking behaviour of RunOrDie and Run
Kubernetes-commit: b09c01c9e2a35b8f91fad319db77bdf8963c05f1
This commit is contained in:
parent
44d47f2411
commit
ffcde95237
@ -193,7 +193,9 @@ type LeaderElector struct {
|
|||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run starts the leader election loop
|
// Run starts the leader election loop. Run will not return
|
||||||
|
// before leader election loop is stopped by ctx or it has
|
||||||
|
// stopped holding the leader lease
|
||||||
func (le *LeaderElector) Run(ctx context.Context) {
|
func (le *LeaderElector) Run(ctx context.Context) {
|
||||||
defer runtime.HandleCrash()
|
defer runtime.HandleCrash()
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -210,7 +212,8 @@ func (le *LeaderElector) Run(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RunOrDie starts a client with the provided config or panics if the config
|
// RunOrDie starts a client with the provided config or panics if the config
|
||||||
// fails to validate.
|
// fails to validate. RunOrDie blocks until leader election loop is
|
||||||
|
// stopped by ctx or it has stopped holding the leader lease
|
||||||
func RunOrDie(ctx context.Context, lec LeaderElectionConfig) {
|
func RunOrDie(ctx context.Context, lec LeaderElectionConfig) {
|
||||||
le, err := NewLeaderElector(lec)
|
le, err := NewLeaderElector(lec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user