mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Comments and safety belts from glasser's review.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
// Subscribe to the `meteor_autoupdate_clientVersions` collection,
|
||||
// which contains the set of acceptable client versions.
|
||||
//
|
||||
// A "hard code push" occurs when the current client version is not in
|
||||
// A "hard code push" occurs when the running client version is not in
|
||||
// the set of acceptable client versions (or the server updates the
|
||||
// collection, and the current client version is no longer in the
|
||||
// set).
|
||||
// collection, there is a published client version marked `current` and
|
||||
// the running client version is no longer in the set).
|
||||
//
|
||||
// When the `reload` package is loaded, a hard code push causes
|
||||
// the browser to reload, so that it will load the latest client
|
||||
// version from the server.
|
||||
//
|
||||
// A "soft code push" represents the situation when the current client
|
||||
// A "soft code push" represents the situation when the running client
|
||||
// version is in the set of acceptable versions, but there is a newer
|
||||
// version available on the server.
|
||||
//
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
// The client version of the client code currently running in the
|
||||
// browser.
|
||||
var autoUpdateVersion = __meteor_runtime_config__.autoUpdateVersion;
|
||||
var autoUpdateVersion = __meteor_runtime_config__.autoUpdateVersion || "unknown";
|
||||
|
||||
|
||||
// The collection of acceptable client versions.
|
||||
|
||||
@@ -45,10 +45,12 @@ AutoUpdate = {};
|
||||
AutoUpdate.autoUpdateVersion = null;
|
||||
|
||||
Meteor.startup(function () {
|
||||
// Allow people to override AutoUpdate.autoUpdateVersion before
|
||||
// startup. Tests do this.
|
||||
if (AutoUpdate.autoUpdateVersion === null)
|
||||
AutoUpdate.autoUpdateVersion =
|
||||
process.env.AUTOUPDATE_VERSION ||
|
||||
process.env.SERVER_ID ||
|
||||
process.env.SERVER_ID || // XXX COMPAT 0.6.6
|
||||
WebApp.clientHash;
|
||||
|
||||
// Make autoUpdateVersion available on the client.
|
||||
@@ -63,12 +65,17 @@ Meteor.publish(
|
||||
// Using `autoUpdateVersion` here is safe because we can't get a
|
||||
// subscription before webapp starts listening, and it doesn't do
|
||||
// that until the startup hooks have run.
|
||||
self.added(
|
||||
"meteor_autoupdate_clientVersions",
|
||||
AutoUpdate.autoUpdateVersion,
|
||||
{current: true}
|
||||
);
|
||||
self.ready();
|
||||
if (AutoUpdate.autoUpdateVersion) {
|
||||
self.added(
|
||||
"meteor_autoupdate_clientVersions",
|
||||
AutoUpdate.autoUpdateVersion,
|
||||
{current: true}
|
||||
);
|
||||
self.ready();
|
||||
} else {
|
||||
// huh? shouldn't happen. Just error the sub.
|
||||
self.error(new Meteor.Error(500, "AutoUpdate.autoUpdateVersion not set"));
|
||||
}
|
||||
},
|
||||
{is_auto: true}
|
||||
);
|
||||
|
||||
@@ -181,9 +181,9 @@ var Connection = function (url, options) {
|
||||
}
|
||||
|
||||
if (msg === null || !msg.msg) {
|
||||
// DEPRECATED. ignore the old welcome message for back compat.
|
||||
// Remove this 'if' once the server stops sending welcome messages
|
||||
// (stream_server.js).
|
||||
// XXX COMPAT WITH 0.6.6. ignore the old welcome message for back
|
||||
// compat. Remove this 'if' once the server stops sending welcome
|
||||
// messages (stream_server.js).
|
||||
if (! (msg && msg.server_id))
|
||||
Meteor._debug("discarding invalid livedata message", msg);
|
||||
return;
|
||||
|
||||
@@ -65,10 +65,10 @@ StreamServer = function () {
|
||||
});
|
||||
self.open_sockets.push(socket);
|
||||
|
||||
// DEPRECATED. Send the old style welcome message, which will force
|
||||
// old clients to reload. Remove this once we're not concerned about
|
||||
// people upgrading from a pre-0.6.7 release. Also, remove the
|
||||
// clause in the client that ignores the welcome message
|
||||
// XXX COMPAT WITH 0.6.6. Send the old style welcome message, which
|
||||
// will force old clients to reload. Remove this once we're not
|
||||
// concerned about people upgrading from a pre-0.6.7 release. Also,
|
||||
// remove the clause in the client that ignores the welcome message
|
||||
// (livedata_connection.js)
|
||||
socket.send(JSON.stringify({server_id: "0"}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user