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

fix: Mutex never gets released on refresh function of AccountTrackerController #4270

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tommasini
Copy link
Contributor

@tommasini tommasini commented May 8, 2024

Explanation

Currently the mutex do not get released unless there is an error thrown by the getBalanceFromChain function
Fixed by move the release of the murex to the finally block. It was also removed unnecessary catch block.

Now the mutex gets released when the logic of refresh runs successfully

Fixed

  • Ensure mutex is released when refresh succeeds
    • Previously the refresh method would remain locked indefinitely after it was run successfully. The mutex was only released upon failure.

References

Changelog

@metamask/assets-controllers

  • FIXED: Mutex released on the finally block of refresh function

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@tommasini tommasini requested a review from a team as a code owner May 8, 2024 17:36
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

The diff looks great! Would you mind filling out the rest of the PR template?

And for the change entry, I would suggest rewording it to describe how the behavior has changed, rather than what we did to change it.

e.g. something like:

### Fixed
- Ensure mutex is released when refresh succeeds
  - Previously the `refresh` method would remain locked indefinitely after it was run successfully. The mutex was only released upon failure.

@tommasini
Copy link
Contributor Author

Added! By mistake I left my description under the comments of the PR template

@legobeat legobeat requested a review from a team May 28, 2024 11:14
Copy link
Contributor

@legobeat legobeat left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants