Skip to content

Fixed bug in doRequest causing requests to not be sent when RetryCount set to 0#1001

Open
ezilber-akamai wants to merge 3 commits into
linode:mainfrom
ezilber-akamai:fix/set-retry
Open

Fixed bug in doRequest causing requests to not be sent when RetryCount set to 0#1001
ezilber-akamai wants to merge 3 commits into
linode:mainfrom
ezilber-akamai:fix/set-retry

Conversation

@ezilber-akamai

Copy link
Copy Markdown
Contributor

📝 Description

Fixed a bug that caused doRequest to 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-unit
make test-int

@ezilber-akamai ezilber-akamai requested review from a team as code owners July 6, 2026 17:49
Copilot AI review requested due to automatic review settings July 6, 2026 17:49
@ezilber-akamai ezilber-akamai added the bugfix for any bug fixes in the changelog. label Jul 6, 2026
@ezilber-akamai ezilber-akamai requested review from mawilk90 and zliang-akamai and removed request for a team July 6, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 doRequest to iterate retryCount + 1 times so retryCount=0 still performs a single request.
  • Clarify SetRetryCount documentation 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

  • SetRetryCount doc comment has an extra trailing period, and the method currently accepts negative counts which would still result in zero requests (since doRequest ranges over retryCount+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.

Comment thread client_test.go Outdated
Comment thread client_test.go
@ezilber-akamai ezilber-akamai added the hotfix for hotfixes that do not have a corresponding Jira ticket label Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread client.go Outdated
Comment thread client.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix for any bug fixes in the changelog. hotfix for hotfixes that do not have a corresponding Jira ticket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants