Log fewer “no heartbeat” messages in tests

Don’t log them for stub streams.

In livedata_connection, fire the onConnected callback *after* we have set up the stream, so we don’t set up a stream that has just been disconnected!
This commit is contained in:
David Greenspan
2014-07-15 18:22:16 -07:00
parent 87688f1a19
commit 88acf81b08
3 changed files with 10 additions and 8 deletions

View File

@@ -216,8 +216,8 @@ var Connection = function (url, options) {
if (msg.msg === 'connected') {
self._version = self._versionSuggestion;
options.onConnected();
self._livedata_connected(msg);
options.onConnected();
}
else if (msg.msg == 'failed') {
if (_.contains(self._supportedDDPVersions, msg.version)) {
@@ -310,7 +310,7 @@ var Connection = function (url, options) {
var onDisconnect = function () {
if (self._heartbeat) {
self._heartbeat.stop()
self._heartbeat.stop();
self._heartbeat = null;
}
};
@@ -543,7 +543,7 @@ _.extend(Connection.prototype, {
stop: function () {
if (!_.has(self._subscriptions, id))
return;
self._subscriptions[id].stop();
},
ready: function () {
@@ -987,7 +987,7 @@ _.extend(Connection.prototype, {
heartbeatInterval: self._heartbeatInterval,
heartbeatTimeout: self._heartbeatTimeout,
onTimeout: function () {
if (Meteor.isClient) {
if (Meteor.isClient && ! self._stream._isStub) {
// only print on the client. this message is useful on the
// browser console to see that we've lost connection. on the
// server (eg when doing server-to-server DDP), it gets

View File

@@ -169,7 +169,7 @@ Tinytest.add("livedata stub - reactive subscribe", function (test) {
completerHandle = conn.subscribe("completer", onReady("completer"));
stopperHandle = conn.subscribe("stopper", onReady("stopper"));
});
var completerReady;
var readyAutorunHandle = Deps.autorun(function() {
completerReady = completerHandle.ready();
@@ -350,7 +350,7 @@ Tinytest.add("livedata stub - reactive subscribe handle correct", function (test
Deps.flush();
test.isTrue(fooHandle.ready());
test.isTrue(fooReady);
autorunHandle.stop();
});

View File

@@ -52,7 +52,9 @@ _.extend(StubStream.prototype, {
_.each(self.callbacks['reset'], function (cb) {
cb();
});
}
},
// Provide a tag to detect stub streams.
// We don't log heartbeat failures on stub streams, for example.
_isStub: true
});