-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
improv: account syncing performance #4726
Conversation
@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.
|
@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.
|
@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.
|
@metamaskbot publish-preview |
1 similar comment
@metamaskbot publish-preview |
@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.
|
await this.messagingSystem.call('KeyringController:addNewAccount'); | ||
await waitForExpectedValue( |
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.
Hehe, nice
if (!this.#accounts.canSync()) { | ||
if ( | ||
!this.#accounts.canSync() || | ||
!isEvmAccountType(internalAccount.type) || |
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.
This is okay. I find that once we have more than 1 boolean operand (&&/||) it gets a little confusing. Maybe could split out into a separate func?
* @returns A promise that resolves when the expected value is returned | ||
* or rejects if the timeout is reached. | ||
*/ | ||
export function waitForExpectedValue<TVariable>( |
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.
Since we had to resort to this, really nice util.
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!
Explanation
This PR adds multiple improvements for the account syncing process, namely:
AccountsController:accountAdded
event to fire before adding another accountReferences
NOTIFY-1158
Changelog
@metamask/profile-sync-controller
isEvmAccountType
before saving an account in user storage in account syncingKeyringType
before saving an account in user storage in account syncingAccountsController:accountAdded
event to fire before adding another account in account syncingChecklist