18 - Changing all hostname to host, fixing some async issues in tests

This commit is contained in:
Nicolas Dextraze
2017-01-28 18:04:58 -08:00
parent f97b7fff8e
commit 006b5b4791
29 changed files with 246 additions and 90 deletions

View File

@ -30,17 +30,20 @@ OperationsManager.prototype.getActiveOperation = function(correlationId) {
return this._activeOperations.get(correlationId);
};
OperationsManager.prototype.cleanUp = function() {
var connectionClosedError = new Error(util.format("Connection '%s' was closed.", this._connectionName));
function cleanUpError(connName, state, operation) {
return new Error(util.format("Connection '%s' was closed. %s %s.", connName, state, operation.toString()));
}
OperationsManager.prototype.cleanUp = function() {
var self = this;
this._activeOperations.forEach(function(correlationId, operation){
operation.operation.fail(connectionClosedError);
operation.operation.fail(cleanUpError(self._connectionName, 'Active', operation));
});
this._waitingOperations.forEach(function(operation) {
operation.operation.fail(connectionClosedError);
operation.operation.fail(cleanUpError(self._connectionName, 'Waiting', operation));
});
this._retryPendingOperations.forEach(function(operation) {
operation.operation.fail(connectionClosedError);
operation.operation.fail(cleanUpError(self._connectionName, 'Pending', operation));
});
this._activeOperations.clear();