Comparing version 0.0.3 to 0.0.4
@@ -10,5 +10,6 @@ var net = require('net'); | ||
return this; | ||
} | ||
}; | ||
Ecad.prototype.fetch = function(fn) { | ||
var that = this; | ||
var opts = this.config; | ||
@@ -31,3 +32,3 @@ var res = []; | ||
client.on('end', function() { | ||
var hosts = this._parse(res); | ||
var hosts = that._parse(res); | ||
if (hosts instanceof Error) return fn(hosts); | ||
@@ -38,3 +39,5 @@ else return fn(null, hosts); | ||
client.on('timeout', function() { | ||
client.removeAllListeners(); | ||
client.end(); | ||
client.destroy(); | ||
return fn(new Error('Elasticache auto-discovery request timed out')); | ||
@@ -41,0 +44,0 @@ }); |
{ | ||
"name": "ecad", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "node.js Elasticache Auto Discovery client", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -42,3 +42,3 @@ var fs = require('fs'); | ||
var hosts = ecad._parse([payload]); | ||
expect(function() { throw hosts }) | ||
expect(function() { throw hosts; }) | ||
.to.throw(/Bad response from Elasticache/); | ||
@@ -50,3 +50,3 @@ }); | ||
var hosts = ecad._parse([payload]); | ||
expect(function() { throw hosts }) | ||
expect(function() { throw hosts; }) | ||
.to.throw(/No Elasticache hosts found/); | ||
@@ -60,3 +60,3 @@ }); | ||
ecad.fetch(function(err, hosts) { | ||
expect(function() { throw err }) | ||
expect(function() { throw err; }) | ||
.to.throw(/Elasticache auto-discovery request timed out/); | ||
@@ -69,16 +69,1 @@ done(); | ||
}); | ||
/* | ||
it('should fail parsing empty payload', function() { | ||
expect(server.config.timeout).to.deep.equal(500); | ||
}); | ||
it('should fail parsing malformed payload', function() { | ||
expect(server.config.timeout).to.deep.equal(500); | ||
}); | ||
it('should timeout and fail if cannot reach host', function() { | ||
expect(server.config.timeout).to.deep.equal(500); | ||
}); | ||
*/ | ||
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
6523
115