diff --git a/packages/livedata/livedata_connection.js b/packages/livedata/livedata_connection.js index 76a421f86c..b9ec551f96 100644 --- a/packages/livedata/livedata_connection.js +++ b/packages/livedata/livedata_connection.js @@ -802,6 +802,11 @@ _.extend(Meteor._LivedataConnection.prototype, { return self._stream.reconnect.apply(self._stream, arguments); }, + close: function () { + var self = this; + return self._stream.forceDisconnect(); + }, + /// /// Reactive user system /// diff --git a/packages/livedata/stream_client_nodejs.js b/packages/livedata/stream_client_nodejs.js index b280561eea..1795974b1c 100644 --- a/packages/livedata/stream_client_nodejs.js +++ b/packages/livedata/stream_client_nodejs.js @@ -62,6 +62,13 @@ _.extend(Meteor._DdpClientStream.prototype, { _onConnect: function (connection) { var self = this; + if (self._forcedToDisconnect) { + // We were asked to disconnect between trying to open the connection and + // actually opening it. Let's just pretend this never happened. + connection.close(); + return; + } + if (self.currentStatus.connected) { // We already have a connection. It must have been the case that // we started two parallel connection attempts (because we diff --git a/tools/deploy-galaxy.js b/tools/deploy-galaxy.js index 75f889cada..b164e8ee06 100644 --- a/tools/deploy-galaxy.js +++ b/tools/deploy-galaxy.js @@ -11,7 +11,7 @@ var getMeteor = function (context) { _meteor = unipackage.load({ library: context.library, packages: [ 'livedata' ], - release: context.releaseVersion, + release: context.releaseVersion }).meteor.Meteor; } @@ -45,7 +45,7 @@ var exitWithError = function (error, messages) { if (msg) process.stderr.write(msg + "\n"); else if (error instanceof Meteor.Error) - process.stderr.write("Denied: " + error.message + "\n") + process.stderr.write("Denied: " + error.message + "\n"); process.exit(1); }; @@ -86,7 +86,7 @@ exports.deploy = function (options) { options.bundleOptions); if (bundleResult.errors) { process.stdout.write("\n\nErrors prevented deploying:\n"); - process.stdout.write(bundleresult.errors.formatMessages()); + process.stdout.write(bundleResult.errors.formatMessages()); process.exit(1); } @@ -158,4 +158,6 @@ exports.deploy = function (options) { process.stderr.write(options.service + ": " + "pushed revision " + result.serial + "\n"); + // Close the connection to Galaxy (otherwise Node will continue running). + galaxy.close(); }; diff --git a/tools/meteor.js b/tools/meteor.js index 0ddbe95848..b756d8cf37 100644 --- a/tools/meteor.js +++ b/tools/meteor.js @@ -818,14 +818,6 @@ Fiber(function () { }); } } - - if (useGalaxy) { - // XXX Under certain circumstances (not yet clear), the websocket - // client in the 'websocket' package will block natural program - // exit even if all of its connections have been closed. So just - // go ahead and explicitly exit the process. - process.exit(0); - } } });