Skip to content

Commit

Permalink
Additional backof delay for retrying Resource.Get Not Found (#1823)
Browse files Browse the repository at this point in the history
It appears that the CDK test suite is still failing, so this change
adjusts the backoff/retry on Resource.Get to be more generous and allow
more time.


https://github.com/pulumi/pulumi-cdk/actions/runs/11818972903/job/32927805461?pr=212
  • Loading branch information
t0yv0 authored Nov 13, 2024
1 parent 55577fd commit 44c2b5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions provider/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (c *clientImpl) getResourceRetryNotFound(
}

func (*clientImpl) getResourceRetryNotFoundRetrySettings() (int, *retry.ExponentialJitterBackoff) {
retryBackoff := retry.NewExponentialJitterBackoff(3 * time.Second)
maxAttempts := 3
retryBackoff := retry.NewExponentialJitterBackoff(5 * time.Second)
maxAttempts := 5
return maxAttempts, retryBackoff
}
12 changes: 11 additions & 1 deletion provider/pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,17 @@ func TestGetResourceRetryNotFoundRetrySettings(t *testing.T) {
for attempt := 0; attempt < attempts; attempt++ {
delay, err := backoff.BackoffDelay(attempt, nil)
require.NoError(t, err)
t.Logf("attempt %d delay is %v", attempt, delay)
totalDelay += delay
}
require.LessOrEqual(t, totalDelay, 10*time.Second)
// Typical test output (though it is random):
//
// client_test.go:378: attempt 0 delay is 745.506998ms
// client_test.go:378: attempt 1 delay is 1.229581817s
// client_test.go:378: attempt 2 delay is 931.993865ms
// client_test.go:378: attempt 3 delay is 5s
// client_test.go:378: attempt 4 delay is 5s
//
// The worst case wait is 25 seconds.
require.LessOrEqual(t, totalDelay, 25*time.Second)
}

0 comments on commit 44c2b5b

Please sign in to comment.