Files
meteor/tools/tests/apps/hot-code-push-test/hot-code-push-test.js
David Glasser 779f942aa3 Improvements to hot-code-push test
This test had been somewhat flaky.  It seems to be less flaky now.
Changes include:

- Trying to not send the client->server logging RPC if the client is
  about to reload due to autoupdate
- Making sure that the client doesn't send anything at all until a
  little bit after starting, in order to make the ordering of messages
  between tool-printed and server-printed messages more predictable

Also updated from standard-app-packages to meteor-tool.
2015-04-02 16:45:39 -04:00

36 lines
1.1 KiB
JavaScript

if (Meteor.isClient) {
var sessionVar = Session.get("sessionVar");
var maybeCall = function () {
var A = Package.autoupdate.Autoupdate;
if (A._ClientVersions.findOne() && ! A.newClientAvailable()) {
Meteor.call("clientLoad",
typeof jsVar === 'undefined' ? 'undefined' : jsVar,
typeof packageVar === 'undefined' ? 'undefined' : packageVar,
sessionVar);
} else {
setTimeout(maybeCall, 100);
}
};
// Wait a little to "ensure" that "client modified" messages (etc) appear
// before our messages
setTimeout(maybeCall, 300);
Session.setDefault("sessionVar", true);
}
if (Meteor.isServer) {
var clientConnections = 0;
Meteor.methods({
clientLoad: function (jsVar, packageVar, sessionVar) {
// Make sure that the process still has the correct working directory.
process.cwd();
console.log("client connected: " + clientConnections++);
console.log("jsVar: " + jsVar);
console.log("packageVar: " + packageVar);
console.log("sessionVar: " + sessionVar);
}
});
}