Skip to content

Don't update the ratelimits if we got a response from a cache#2273

Merged
gmlewis merged 1 commit into
google:masterfrom
Jille:ratelimits-from-cache
Feb 17, 2022
Merged

Don't update the ratelimits if we got a response from a cache#2273
gmlewis merged 1 commit into
google:masterfrom
Jille:ratelimits-from-cache

Conversation

@Jille

@Jille Jille commented Jan 26, 2022

Copy link
Copy Markdown
Contributor

The recommended cache, https://github.com/gregjones/httpcache, returns
an X-From-Cache: 1 header whenever it serves a response from the cache.

Cached responses might include (possibly stale) ratelimit headers, which
we would've already processed in the past.

@codecov

codecov Bot commented Jan 26, 2022

Copy link
Copy Markdown

Codecov Report

Merging #2273 (2b58fd7) into master (a842efc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2273   +/-   ##
=======================================
  Coverage   97.83%   97.83%           
=======================================
  Files         115      115           
  Lines       10360    10363    +3     
=======================================
+ Hits        10136    10139    +3     
  Misses        156      156           
  Partials       68       68           
Impacted Files Coverage Δ
github/github.go 97.64% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a842efc...2b58fd7. Read the comment docs.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @Jille !
Can you please add a unit test that demonstrates this change in functionality?

Also, once you sign the CLA, we can move forward with this PR.

The recommended cache, https://github.com/gregjones/httpcache, returns
an X-From-Cache: 1 header whenever it serves a response from the cache.

Cached responses might include (possibly stale) ratelimit headers, which
we would've already processed in the past.
@Jille Jille force-pushed the ratelimits-from-cache branch from 155f27f to 2b58fd7 Compare February 7, 2022 10:01
@Jille

Jille commented Feb 7, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for the quick review :)

Added tests, rebased to master, signed the CLA.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @Jille !
LGTM.

Awaiting second LGTM from any other contributor to this repo before merging.

@raynigon raynigon 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.

LGTM

@gmlewis

gmlewis commented Feb 17, 2022

Copy link
Copy Markdown
Collaborator

Thank you, @raynigon !
Merging.

@gmlewis gmlewis merged commit 77b2d75 into google:master Feb 17, 2022
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
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.

3 participants