connection-manager
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -40,5 +40,7 @@ /** | ||
var count = client.references.getCount(); | ||
debug('client: ' + client.id + ' reference count: ' + count); | ||
if ((count > 0) && (! client.isConnected())) { | ||
client.connect.apply(buildScope(scope, client), function (err, c) { | ||
debug('client ' + client.id + ' is disconnected, but reference count: ' + count + ', reconnecting...'); | ||
var scopes = client.references.getIdentifiers(); | ||
var scope = client.references.getRecord(scopes[0]); | ||
client.connect.call(buildScope(scope, client), function (err, c) { | ||
if (err) { | ||
@@ -52,5 +54,9 @@ debug('failed reconnecting: ', err); | ||
}); | ||
for (var i = 1, len = scopes.length; i < len; i++) { | ||
client = registerListeners(client.references.getRecord(scopes[i]), client); | ||
} | ||
} | ||
}); | ||
}, 60000); | ||
}, 30000); | ||
} | ||
@@ -272,5 +278,5 @@ } | ||
client.connection = c; | ||
client.disconnect.apply(buildScope(scope, client), [function () { | ||
client.disconnect.call(buildScope(scope, client), function () { | ||
self.clients.removeRecord(client.id); | ||
}]); | ||
}); | ||
debug('skipping connect due to abort timeout.'); | ||
@@ -387,5 +393,5 @@ return cb('skipping connect due to abort timeout.'); // abort, callback already called | ||
debug('references: ', client.references.getIdentifiers()); | ||
client.disconnect.apply(buildScope(scope, client), [function () { | ||
client.disconnect.call(buildScope(scope, client), function () { | ||
self.clients.removeRecord(id); | ||
}]); | ||
}); | ||
} catch (e) { | ||
@@ -392,0 +398,0 @@ throw new Error(e); |
{ | ||
"name": "connection-manager", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Store, checkout & keepalive active connections from multiple locations in your code-base.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36757
956