I’m messing around with optimistic UI a bit, so I created /both/methods.js
and put this in it:
Meteor.methods({
incLikes() {
Meteor.isServer && Meteor._sleepForMs(5000);
Likes.update({}, {$inc: {likeCount: 1}});
}
});
And then I have a React component that is a like button and a display that shows the value of likeCount
. Of course, the likeCount
is 0 and I click “Like,” on the client it increases to 1, and five seconds later the server reflects this update.
What I’m wondering is, how long will minimongo and mongo wait to be in sync? Is there a timeout where an error will be thrown? If not, how do I create this type of mechanism?