connection-manager
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -34,12 +34,19 @@ /** | ||
var reconnecting = false; | ||
var self = this; | ||
if (! reportingActive) { | ||
reportingActive = true; | ||
setInterval(function _report() { | ||
setInterval(function __report() { | ||
self.clients.forEachRecord(function (client) { | ||
var count = client.references.getCount(); | ||
if ((count > 0) && (! client.isConnected())) { | ||
if ((count > 0) && ((typeof client.isConnected !== 'function') || (! client.isConnected())) && (! reconnecting)) { | ||
debug('client ' + client.id + ' is disconnected, but reference count: ' + count + ', reconnecting...'); | ||
var scopes = client.references.getIdentifiers(); | ||
var scope = client.references.getRecord(scopes[0]); | ||
var scopes = client.references.getIdentifiers(); | ||
var scope = client.references.getRecord(scopes[0]); | ||
reconnecting = true; | ||
client.connect.call(buildScope(scope, client), function (err, c) { | ||
@@ -53,2 +60,3 @@ if (err) { | ||
client = registerListeners(scope, client); | ||
reconnecting = false; | ||
}); | ||
@@ -61,3 +69,3 @@ | ||
}); | ||
}, 30000); | ||
}, 60000); | ||
} | ||
@@ -251,3 +259,3 @@ } | ||
o.timeout = (typeof o.timeout === 'number') ? o.timeout : 6000; | ||
o.timeout = (typeof o.timeout === 'number') ? o.timeout : 10000; | ||
@@ -374,3 +382,3 @@ var client = { | ||
debug('removing reference ' + id); | ||
debug('removing reference ' + id + ' scope_id: ' + scope.id); | ||
// first thing is we decrese the count by removing the session | ||
@@ -454,2 +462,3 @@ client.references.removeRecord(scope.id); | ||
var removeListener = client.removeListener; | ||
var isConnected = client.isConnected; | ||
var disconnect = client.disconnect; | ||
@@ -465,2 +474,3 @@ | ||
removeListener: removeListener, | ||
isConnected: isConnected, | ||
disconnect: disconnect, | ||
@@ -522,5 +532,5 @@ }; | ||
/** | ||
* Function: getIDs | ||
* Function: getKeys | ||
* | ||
* returns all IDs existing within the namespace | ||
* returns all keys existing within the namespace | ||
* | ||
@@ -539,2 +549,3 @@ * Parameters: | ||
module.exports = ConnectionManager; |
{ | ||
"name": "connection-manager", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Store, checkout & keepalive active connections from multiple locations in your code-base.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
Sorry, the diff of this file is not supported yet
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
37030
961