Conversation
ggazzo
previously approved these changes
Jun 10, 2019
ggazzo
previously approved these changes
Jun 10, 2019
ggazzo
approved these changes
Jun 11, 2019
rodrigok
approved these changes
Jun 11, 2019
This was referenced Jun 13, 2019
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the very first step in moving the code base away from any Meteor dependency.
The idea is to do this in parts, without breaking any code that depends on the "extracted" functions. So all extracted functions will be changed to return Promises, but to not break the current code we'll be also exporting those functions with
Promise.await, so they'll still run "sync" in a Fiber environment.So as you can see, here is the new promisified version of
canAccessRoomand here is thePromise.awaitversion being exported. So from now on, all code running within a Fiber that wants to use thecanAccessRoomfunction will have to import thePromise.awaitversion (as you can see here)The same applies to all other rewrited functions like hasPermission.
In order to accomplish that, we had to move away from Meteor collections as well, because they are designed to run within a Fiber. So I have created a new raw.js file in
/modeldirectory, that exports the new "raw" (actually, MongoDB driver collections) version of a regular model. The collections methods are being rewritten as needed.The last bit included in this PR is related to Settings, the same reason as the collections, the old settings objects relies on Fibers, so I've created a simple cached get/set functions feeded by a new observer