statful-client
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -7,3 +7,3 @@ 'use strict'; | ||
URL = require('url'), | ||
httpsAgent = new https.Agent({ keepAlive: true }), | ||
httpsAgent = new https.Agent({ maxSockets: 50, keepAlive: true }), | ||
merge = require('merge'), | ||
@@ -76,11 +76,16 @@ zlib = require('zlib'), | ||
req.setTimeout(options.timeout); | ||
req.on('error', function(e) { | ||
logger.error('An error occurred: ' + e.message); | ||
if (e.code === "ECONNRESET") { | ||
logger.error('A timeout occurred on a request to host: ' + options.hostname + | ||
' port: ' + options.port + ' and path: ' + options.path); | ||
} else { | ||
logger.error('An error occurred: ' + e.message); | ||
} | ||
}); | ||
req.on('timeout', function(){ | ||
logger.error('A timeout occurred on a request to host: ' + options.hostname + | ||
' port: ' + options.port + ' and path: ' + options.path); | ||
req.on('socket', function (socket) { | ||
socket.setTimeout(options.timeout); | ||
socket.on('timeout', function() { | ||
req.abort(); | ||
}); | ||
}); | ||
@@ -269,3 +274,5 @@ | ||
if ( (self.aggregatedBuffer.bufferSize + self.nonAggregatedBuffer.bufferSize) >= self.flushSize) { | ||
flush(self); | ||
setTimeout(function() { | ||
flush(self); | ||
}, 0); | ||
} | ||
@@ -272,0 +279,0 @@ } else { |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"engines": { | ||
@@ -16,0 +16,0 @@ "node": ">=0.8" |
@@ -551,5 +551,7 @@ 'use strict'; | ||
// Then | ||
expect(victim.logger.debug.getCall(0).args[0]).to.match(/^Flushing metrics \(non aggregated\): application.my_metric 1 \d+$/); | ||
victim.logger.debug.restore(); | ||
done(); | ||
setTimeout(function () { | ||
expect(victim.logger.debug.getCall(0).args[0]).to.match(/^Flushing metrics \(non aggregated\): application.my_metric 1 \d+$/); | ||
victim.logger.debug.restore(); | ||
done(); | ||
}); | ||
@@ -576,5 +578,7 @@ }); | ||
// Then | ||
expect(victim.logger.debug.getCall(0).args[0]).to.match(/^Flushing metrics \(aggregated\): application.my_metric 1 \d+\napplication\.my_metric 1 \d+$/); | ||
victim.logger.debug.restore(); | ||
done(); | ||
setTimeout(function () { | ||
expect(victim.logger.debug.getCall(0).args[0]).to.match(/^Flushing metrics \(aggregated\): application.my_metric 1 \d+\napplication\.my_metric 1 \d+$/); | ||
victim.logger.debug.restore(); | ||
done(); | ||
}); | ||
@@ -601,7 +605,8 @@ }); | ||
// Then | ||
expect(victim.logger.debug.getCall(0).args[0]).to.match(/^Flushing metrics \(non aggregated\): application.my_metric 1 \d+$/); | ||
expect(victim.logger.debug.getCall(1).args[0]).to.match(/^Flushing metrics \(aggregated\): application.my_metric 1 \d+\napplication\.my_metric 1 \d+$/); | ||
victim.logger.debug.restore(); | ||
done(); | ||
setTimeout(function () { | ||
expect(victim.logger.debug.getCall(0).args[0]).to.match(/^Flushing metrics \(non aggregated\): application.my_metric 1 \d+$/); | ||
expect(victim.logger.debug.getCall(1).args[0]).to.match(/^Flushing metrics \(aggregated\): application.my_metric 1 \d+\napplication\.my_metric 1 \d+$/); | ||
victim.logger.debug.restore(); | ||
done(); | ||
}); | ||
}); | ||
@@ -625,6 +630,7 @@ | ||
// Then | ||
expect(victim.logger.debug.getCall(1).args[0]).to.be.equal('Can\'t flush aggregated metrics using udp transport.'); | ||
expect(victim.aggregatedBuffer.bufferSize).to.be.equal(0); | ||
victim.logger.debug.restore(); | ||
done(); | ||
setTimeout(function () { | ||
expect(victim.logger.debug.getCall(1).args[0]).to.be.equal('Can\'t flush aggregated metrics using udp transport.'); | ||
expect(victim.aggregatedBuffer.bufferSize).to.be.equal(0); | ||
done(); | ||
}); | ||
@@ -631,0 +637,0 @@ }); |
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
93489
2116