mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-13 00:46:16 -06:00
Another race in resource.Retry
This commit is contained in:
parent
5802f76eaa
commit
074be9ae56
@ -20,13 +20,15 @@ func Retry(timeout time.Duration, f RetryFunc) error {
|
|||||||
MinTimeout: 500 * time.Millisecond,
|
MinTimeout: 500 * time.Millisecond,
|
||||||
Refresh: func() (interface{}, string, error) {
|
Refresh: func() (interface{}, string, error) {
|
||||||
rerr := f()
|
rerr := f()
|
||||||
|
|
||||||
|
resultErrMu.Lock()
|
||||||
|
defer resultErrMu.Unlock()
|
||||||
|
|
||||||
if rerr == nil {
|
if rerr == nil {
|
||||||
resultErr = nil
|
resultErr = nil
|
||||||
return 42, "success", nil
|
return 42, "success", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
resultErrMu.Lock()
|
|
||||||
defer resultErrMu.Unlock()
|
|
||||||
resultErr = rerr.Err
|
resultErr = rerr.Err
|
||||||
|
|
||||||
if rerr.Retryable {
|
if rerr.Retryable {
|
||||||
|
Loading…
Reference in New Issue
Block a user