-
-
Notifications
You must be signed in to change notification settings - Fork 223
perf(keyring-controller): do not fire unnecessary :stageChange
in withKeyring
#5732
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
Conversation
ba27fd6
to
f603e07
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Co-authored-by: Michele Esposito <[email protected]>
this.#assertIsUnlocked(); | ||
return this.#persistOrRollback(async () => true); | ||
return this.#withRollback(async () => { | ||
this.#assertIsUnlocked(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I suggested to place the assertion after acquiring the mutex on purpose: I think we should change all the other ones as well (in another PR)
#5757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Explanation
We were always calling
#updateVault
when usingwithKeyring
even when the keyring was not mutated.This PR now compare the states after the operation execution and see if the keyring got updated or not and decide to call
#updateVault
only if needed.Testing PR:
References
N/A
Changelog
N/A
Checklist