Skip to content

fix: update rate limits from HTTP error responses - #877

Merged
anthony-gomez-fastly merged 4 commits into
fastly:mainfrom
Shubham-Padkonde:fix/rate-limit-error-responses
Oct 21, 2026
Merged

anthony-gomez-fastly merged 4 commits into
fastly:mainfrom
Shubham-Padkonde:fix/rate-limit-error-responses

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 27, 2026 •

Copy link
Copy Markdown

Change summary

Update the client's rate-limit counters from valid response headers before returning an HTTP error. Previously, a 429 response left RateLimitRemaining() and RateLimitReset() at their previous values, making client-level backoff decisions use stale information.

The original response and error are still returned. Missing or malformed headers retain the prior values, canceled requests with no response are safe, and GET/HEAD behavior is unchanged.

Fixes #857.

All Submissions:

  • Have you followed the guidelines in our Contributing document? Validation details and platform limits are below; the changelog links to this PR.
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

Validation after merging current main (Linux, Go 1.26.10):

  • make all passes: module download/tidy, golangci-lint formatting and lint, and the full recorded-fixture test suite.
  • The changelog entry remains under Unreleased, above the v18.0.0 release.
  • git diff --check passes; module files unchanged.
  • Semgrep is not installed, so the Makefile's optional Semgrep step did not run. Race detection and live Fastly API tests were not run.
  • The original regression validation demonstrated four failing cases before the fix.

User Impact

Callers can read updated rate-limit state through the existing client accessors after rejected write requests.

Release considerations

No public API changes or new dependencies. Prepared and tested with Codex assistance.

@Shubham-Padkonde
Shubham-Padkonde requested a review from a team as a code owner September 27, 2026 07:03

@anthony-gomez-fastly anthony-gomez-fastly left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you for your contribution!

@anthony-gomez-fastly

Copy link
Copy Markdown
Member

@Shubham-Padkonde please fix the changelog and it should be good to go once @rcaril reviews as well

@anthony-gomez-fastly
anthony-gomez-fastly merged commit 4eba3ca into fastly:main Oct 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RateLimitRemaining isn't updated on error, including 429 rate limiting errors

3 participants