Fix bug where we would never quiesce if we tried to revive subs that errored out.

This specifically would happen if you ran an app with at least one sub with a
ready message (ie not autopublish; eg parties) with auth, logged in, and then
killed the app and replaced it with a different app.  Hot code push would stall
and the new app would not load until you hit reload.

Why? Due to the login method call, hot code push had to wait for the login
method to be done. A method being done, in this case, includes having all its
data visible. This means waiting for the at-reconnect global quiescence to
finish. But this would never happen, since that requires waiting for all subs
that had been ready to become ready again, and instead the subs were getting
nosub because this is an entirely different app.
This commit is contained in:
David Glasser
2013-06-06 22:58:21 -07:00
parent d27a3b4aa6
commit 5e7138d49e

View File

@@ -948,6 +948,10 @@ _.extend(Meteor._LivedataConnection.prototype, {
if (self._waitingForQuiescence()) {
self._messagesBufferedUntilQuiescence.push(msg);
if (msg.msg === "nosub")
delete self._subsBeingRevived[msg.id];
_.each(msg.subs || [], function (subId) {
delete self._subsBeingRevived[subId];
});
@@ -1182,6 +1186,14 @@ _.extend(Meteor._LivedataConnection.prototype, {
_livedata_nosub: function (msg) {
var self = this;
// First pass it through _livedata_data, which only uses it to help get
// towards quiescence.
self._livedata_data(msg);
// Do the rest of our processing immediately, with no
// buffering-until-quiescence.
// we weren't subbed anyway, or we initiated the unsub.
if (!_.has(self._subscriptions, msg.id))
return;
@@ -1193,6 +1205,14 @@ _.extend(Meteor._LivedataConnection.prototype, {
}
},
_process_nosub: function () {
// This is called as part of the "buffer until quiescence" process, but
// nosub's effect is always immediate. It only goes in the buffer at all
// because it's possible for a nosub to be the thing that triggers
// quiescence, if we were waiting for a sub to be revived and it dies
// instead.
},
_livedata_result: function (msg) {
// id, result or error. error has error (code), reason, details