chpr-metrics
Advanced tools
Comparing version 1.1.0 to 1.2.0
22
index.js
@@ -23,2 +23,20 @@ 'use strict'; | ||
/** | ||
* Create a StatsD client | ||
* | ||
* @param {object} config | ||
* @returns {StatsDClient} | ||
*/ | ||
function createStatsDClient(config) { | ||
const client = new StatsDClient(config); | ||
/** | ||
* The following line is preventing a Node.js process | ||
* to stay alive even if all other tasks are done. | ||
*/ | ||
client.socket.unref(); | ||
return client; | ||
} | ||
const configs = []; | ||
@@ -40,3 +58,3 @@ if (process.env.METRICS_HOST) { | ||
if (configs.length === 1) { | ||
module.exports = new StatsDClient(configs[0]); | ||
module.exports = createStatsDClient(configs[0]); | ||
} else { | ||
@@ -65,4 +83,4 @@ /** | ||
} | ||
const clients = configs.map(config => new StatsDClient(config)); | ||
const clients = configs.map(config => createStatsDClient(config)); | ||
module.exports = new StatsDClientsProxy(clients); | ||
} |
{ | ||
"name": "chpr-metrics", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Chauffeur Privé's statsd configuration", | ||
@@ -25,3 +25,3 @@ "repository": { | ||
"co-mocha": "1.1.3", | ||
"eslint-config-cp": "github:transcovo/eslint-config-cp#1.1.0", | ||
"eslint-config-cp": "1.1.0", | ||
"istanbul": "0.4.5", | ||
@@ -37,4 +37,4 @@ "mocha": "3.2.0", | ||
"engines": { | ||
"node": ">4.0.0" | ||
"node": "4.8.4" | ||
} | ||
} | ||
} |
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
9210
11
169