mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Use 15-second timeout for service connections
This should reduce failures to send package stats.
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ LivedataTest.ClientStream = function (endpoint, options) {
|
||||
|
||||
self.headers = self.options.headers || {};
|
||||
|
||||
self._initCommon();
|
||||
self._initCommon(options);
|
||||
|
||||
//// Kickoff!
|
||||
self._launchConnection();
|
||||
|
||||
@@ -6,7 +6,7 @@ LivedataTest.ClientStream = function (url, options) {
|
||||
self.options = _.extend({
|
||||
retry: true
|
||||
}, options);
|
||||
self._initCommon();
|
||||
self._initCommon(options);
|
||||
|
||||
//// Constants
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user