Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Revert error should not be retried - #254

Merged
jpuri merged 11 commits into
mainfrom
revert_fix
Oct 23, 2023
Merged

jpuri merged 11 commits into
mainfrom
revert_fix

Conversation

@jpuri

@jpuri jpuri commented Oct 12, 2023 •

Copy link
Copy Markdown
Contributor

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/1461

This is an issue brought up by blockaid team, in case of revert we should not retry and send back original error.

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

This change makes sense. I also checked the other middleware to make sure there wasn't any other place we needed to do this. The fetch middleware also retries requests, but has an allowlist of retriable errors, and this revert error isn't one of them, so we're good on that (these retriable errors, by the way, are what I think the issue you found is referring to).

Also — and this is just a sidebar — I don't really know why retryOnEmpty retries errors; based on its name it should only retry empty requests. Unfortunately I don't have enough context on this to know what the right thing to do here is, so it's probably best to leave it alone.

In conclusion, your change makes sense, I just had some tweaks.

Comment thread src/retryOnEmpty.ts Outdated
@jpuri

jpuri commented Oct 16, 2023

Copy link
Copy Markdown
Contributor Author

Hey @mcmire : I updated the PR and also added unit test coverage.

@jpuri
jpuri marked this pull request as ready for review October 16, 2023 14:13
@jpuri
jpuri requested a review from a team as a code owner October 16, 2023 14:13
@jpuri
jpuri requested a review from mcmire October 16, 2023 14:13

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

Just a few suggestions. Solution looks good aside from this though!

Comment thread src/retryOnEmpty.test.ts Outdated
Comment thread src/retryOnEmpty.ts Outdated
Comment thread test/util/helpers.ts
Comment thread src/utils/error.test.ts Outdated
jpuri and others added 4 commits October 17, 2023 13:54
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
@jpuri
jpuri requested a review from mcmire October 17, 2023 09:58
@jpuri

jpuri commented Oct 17, 2023

Copy link
Copy Markdown
Contributor Author

Hey @mcmire : thanks a lot for review feedbacks, I addressed all of those.

Comment thread test/util/helpers.ts Outdated
@jpuri
jpuri requested a review from mcmire October 20, 2023 08:51

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

Looks good!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants