Fixed bug in doRequest causing requests to not be sent when RetryCount set to 0#1001
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Client.doRequest retry loop semantics so a request is still attempted when RetryCount is set to 0, aligning behavior with “retries after the initial attempt” expectations.
Changes:
- Update
doRequestto iterateretryCount + 1times soretryCount=0still performs a single request. - Clarify
SetRetryCountdocumentation to define “retries” vs “attempts”. - Add a regression unit test for
retryCount=0.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
client.go |
Adjusts retry loop to ensure at least one attempt; updates retry-count semantics documentation. |
client_test.go |
Adds a regression test covering the retryCount=0 behavior. |
Comments suppressed due to low confidence (1)
client.go:478
SetRetryCountdoc comment has an extra trailing period, and the method currently accepts negative counts which would still result in zero requests (sincedoRequestranges overretryCount+1). Consider clamping negatives to 0 so at least one request is always attempted.
// SetRetryCount sets the number of retries after the initial request before aborting. .
func (c *Client) SetRetryCount(count int) *Client {
c.retryCount = count
return c
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b61fc0d to
7e12004
Compare
yec-akamai
approved these changes
Jul 6, 2026
zliang-akamai
approved these changes
Jul 6, 2026
7defccf to
9bc5834
Compare
zliang-akamai
approved these changes
Jul 6, 2026
mawilk90
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Fixed a bug that caused
doRequestto send no requests when the RetryCount is set to 0. New behavior now mimics resty, where at least one request is always sent, with the number of retries (not total requests) dictated by SetRetryCount.✔️ How to Test
make tet-unitmake test-int