diff --git a/packages/livedata/livedata_connection.js b/packages/livedata/livedata_connection.js index b9474a1746..725e4c534d 100644 --- a/packages/livedata/livedata_connection.js +++ b/packages/livedata/livedata_connection.js @@ -58,7 +58,8 @@ var Connection = function (url, options) { // fail (e.g. sending package usage stats). At some point we // should have a real API for handling client-stream-level // errors. - _dontPrintErrors: options._dontPrintErrors + _dontPrintErrors: options._dontPrintErrors, + connectTimeoutMs: options.connectTimeoutMs }); } diff --git a/packages/livedata/stream_client_common.js b/packages/livedata/stream_client_common.js index b8812874a1..46110506f4 100644 --- a/packages/livedata/stream_client_common.js +++ b/packages/livedata/stream_client_common.js @@ -96,13 +96,13 @@ _.extend(LivedataTest.ClientStream.prototype, { }, - _initCommon: function () { + _initCommon: function (options) { var self = this; //// Constants // how long to wait until we declare the connection attempt // failed. - self.CONNECT_TIMEOUT = 10000; + self.CONNECT_TIMEOUT = options.connectTimeoutMs || 10000; self.eventCallbacks = {}; // name -> [callback] diff --git a/packages/livedata/stream_client_nodejs.js b/packages/livedata/stream_client_nodejs.js index d5cff1640d..3204056e95 100644 --- a/packages/livedata/stream_client_nodejs.js +++ b/packages/livedata/stream_client_nodejs.js @@ -22,7 +22,7 @@ LivedataTest.ClientStream = function (endpoint, options) { self.headers = self.options.headers || {}; - self._initCommon(); + self._initCommon(options); //// Kickoff! self._launchConnection(); diff --git a/packages/livedata/stream_client_sockjs.js b/packages/livedata/stream_client_sockjs.js index b7e39a13a4..8742f299a0 100644 --- a/packages/livedata/stream_client_sockjs.js +++ b/packages/livedata/stream_client_sockjs.js @@ -6,7 +6,7 @@ LivedataTest.ClientStream = function (url, options) { self.options = _.extend({ retry: true }, options); - self._initCommon(); + self._initCommon(options); //// Constants diff --git a/tools/service-connection.js b/tools/service-connection.js index c290ec98ee..877a46e03e 100644 --- a/tools/service-connection.js +++ b/tools/service-connection.js @@ -30,6 +30,10 @@ var ServiceConnection = function (Package, endpointUrl, options) { // ServiceConnection never should retry connections: just one TCP connection // is enough, and any errors on it should be detected promptly. options = _.extend({}, options, { + // We found that this was likely to time out with the DDP default of 10s, + // especially if the CPU is churning on bundling (eg, for the stats + // connection which we start in parallel with bundling). + connectTimeoutMs: 15000, retry: false, onConnected: function () { if (!self.currentFuture)