mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
Fix goroutine leak in RetryUntilSucceed (#1314)
This commit is contained in:
parent
e482d74d19
commit
1f675f4bb9
1 changed files with 3 additions and 0 deletions
|
|
@ -85,10 +85,13 @@ func MakeSignature(size int) ([]byte, error) {
|
|||
// RetryUntilSucceed keep retrying given action with specified timeout until action succeed or specified context is done.
|
||||
func RetryUntilSucceed(action func() error, desc string, ctx context.Context, timeout time.Duration) {
|
||||
ctxCompleted := false
|
||||
stop := make(chan bool)
|
||||
defer close(stop)
|
||||
go func() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
ctxCompleted = true
|
||||
case <-stop:
|
||||
}
|
||||
}()
|
||||
for {
|
||||
|
|
|
|||
Loading…
Reference in a new issue