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

[BUG]: Failed API calls update response cache #2876

Closed
1 task done
daverant opened this issue Feb 3, 2024 · 1 comment · Fixed by #2877
Closed
1 task done

[BUG]: Failed API calls update response cache #2876

daverant opened this issue Feb 3, 2024 · 1 comment · Fixed by #2877
Labels
Type: Bug Something isn't working as documented

Comments

@daverant
Copy link
Contributor

daverant commented Feb 3, 2024

What happened?

The response cache in CachingHttpClient is called even when GitHub returns a non-2xx and non-304 status code. It's likely that implementations of IResponseCache will only want to cache data for successful responses. Without this check, it's easy for implementations to miss this check and flush valid responses from the cache when receiving a non-2xx response, resulting in an increase of subsequent cache misses.

This is an opinionated change - it's reasonable to expect implementations to cater for this themselves, but feels like it would help users more than hinder (I can't think of a use case for caching non-successful responses).

Versions

octokit.net v9.1.2, net7.0

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@daverant daverant added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Feb 3, 2024
@kfcampbell kfcampbell removed the Status: Triage This is being looked at and prioritized label Feb 5, 2024
@kfcampbell
Copy link
Member

I'm generally okay with this approach. @nickfloyd are you?

I'm also curious how redirect status codes (like a 301 or 307) affect caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
Archived in project
2 participants