Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional backof delay for retrying Resource.Get Not Found #1823

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading