-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Asyncify _checkForCaseInsensitiveDuplicates #13076
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
Asyncify _checkForCaseInsensitiveDuplicates #13076
Conversation
…arryadel/meteor into fix/_checkForCaseInsensitiveDuplicates
Added on the list for 2.16. |
} | ||
const user = { services: {} }; | ||
return Accounts._createUserCheckingDuplicates({ | ||
return await Accounts._createUserCheckingDuplicates({ |
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.
I believe it's a matter of taste, but usually, using return await isn't necessary. You can typically return the promise directly in an async function.
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.
I know it might seem redundant but it's just clear.
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.
I think there are still changes needed to the proper adoption.
@harryadel out of curiosity, why do you call this internal method in your app? |
@jamauro We've this unique case in our application where we have the user |
…arryadel/meteor into fix/_checkForCaseInsensitiveDuplicates
@nachocodoner I ended up asyncfying On the 3.0 branch is this fixed? Is the accounts-password package completely free of sync db-calls?? |
It seems that is adapted actually. If you look into the release-3.0 branch you will see the code using async, and the ones you adapted here, already migrated. In the changelog we keep the list of package's API that have been migrated to async, for instance, for the Alternatively we could have async versions for |
Our philosophy so far has been to get everything asyncified, just like you mentioned with Accounts.setPasswordAsync so that when we run Though my opinion on this isn't set in stone, let's see what Denis & Grubba has to say about this. |
I would go in the safe route here... We decided to create those We should focus on not breaking changes and making those breaking changes as easy as possible for those making the transition. We could have // 2.x
Accounts.addEmail // <- sync
Accounts.addEmailAsync // <- resolves to promise
// 3.x
Accounts.addEmail // <- resolves to promise it is just an alias to the addEmailAsync
Accounts.addEmailAsync // <- resolves to promise |
That makes sense. We didn't do the same for 3.x and instead change to async directly. But we may change this now, since I don't think compromise a lot. So, if you can adapt this @harryadel to use async versions instead, that would be great. |
@nachocodoner so I'd duplicate the functions and create async alternatives so it doesn't break anything for 2.x or just change the variables names to use the |
This is better to stick into the convention. This way we won't force any breaking changes on the new update. |
We plan to release this week 2.16. @harryadel: Do you want to include this on release 2.16? How is the state of the feedback applied? We should create async versions as stated here and keep easy migration with 3.x, #13076 (comment) |
I had initially started this PR to help ease our migration to 3.0 but since we're already attempting to migrate to the latest RC it seizes to grant any value for us. Plus, it was discarded in 2.16 release. |
In our application we call
_createUserCheckingDuplicates
and I found out it's not async-friendly yet. Can we please add it to 2.16?