Skip to content

Commit

Permalink
Make sure final value arrives to DoneCh() always
Browse files Browse the repository at this point in the history
stopCh is already selected in renewAuth() and renewLease(), so this case block is not needed here and otherwise, it causes a race condition and sometimes the final result doesn't arrive in the DoneCh()
  • Loading branch information
bonifaido committed May 4, 2018
1 parent eef0d36 commit 4eadbd8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions api/renewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,7 @@ func (r *Renewer) Renew() {
result = r.renewLease()
}

select {
case r.doneCh <- result:
case <-r.stopCh:
}
r.doneCh <- result
}

// renewAuth is a helper for renewing authentication.
Expand Down

0 comments on commit 4eadbd8

Please sign in to comment.