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

Clear last_response on errors #1260

Merged
merged 2 commits into from
May 22, 2020

Conversation

JackTLi
Copy link

@JackTLi JackTLi commented May 21, 2020

When an error occurs, the last_response does not get updated so last_response here actually starts showing the last successful response rather than the raw last response.

On Shopify/shipit-engine, we had a problem due to this behaviour in sidekiq where API requests are failing and we end up processing the last_response from the previous job on the thread.

This change makes it so that if an error is raised, clear the last_response cache to prevent leaky reads, while reraising the error so that functionality stays mostly the same.

I think this better captures the behavior I would expect form a last_response cache, at least to prevent "stale" reads.

Thanks!

When an error occurs, the last_response does not get updated so it's
possible to start inspecting the last last response.

This change makes it so that if an error is raised, clear the
last_response cache to prevent leaky reads
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.

2 participants