@fiverr/statsd-client
Advanced tools
Comparing version 1.0.7 to 1.0.8-rc-0f2c65b
@@ -116,3 +116,3 @@ const sample = require('sample-size'); | ||
process.on('exit', this.flush); | ||
process.on('beforeExit', this.flush); | ||
} | ||
@@ -180,3 +180,3 @@ | ||
destroy() { | ||
process.off('exit', this.flush); | ||
process.off('beforeExit', this.flush); | ||
this.send.destroy(); | ||
@@ -183,0 +183,0 @@ } |
const { createConnection } = require('net'); | ||
const { on, off } = require('../signals'); | ||
@@ -6,2 +7,14 @@ const ENCODING = 'ascii'; | ||
/** | ||
* Timeout ID | ||
* @type {number} | ||
*/ | ||
let timer; | ||
/** | ||
* Maximum idle time to leave a socket open | ||
* @type {number} | ||
*/ | ||
const SOCKET_TIMEOUT = 3000; | ||
/** | ||
* Private socket instance | ||
@@ -33,2 +46,6 @@ * @type {Socket} | ||
clearTimeout(timer); | ||
on(endSocket); | ||
timer = setTimeout(endSocket, SOCKET_TIMEOUT); | ||
return socket; | ||
@@ -45,5 +62,5 @@ } | ||
} | ||
off(endSocket); | ||
closing = true; | ||
socket && socket.end(derefSocket); | ||
process.off('exit', endSocket); | ||
} | ||
@@ -84,3 +101,2 @@ | ||
if (!teardown) { | ||
process.on('exit', endSocket); | ||
teardown = true; | ||
@@ -87,0 +103,0 @@ } |
const { createSocket } = require('dgram'); | ||
const { on, off } = require('../signals'); | ||
/** | ||
* Timeout ID | ||
* @type {number} | ||
*/ | ||
let timer; | ||
/** | ||
* Maximum idle time to leave a socket open | ||
* @type {number} | ||
*/ | ||
const SOCKET_TIMEOUT = 3000; | ||
/** | ||
* Private socket instance | ||
@@ -30,2 +43,6 @@ * @type {Socket} | ||
clearTimeout(timer); | ||
on(endSocket); | ||
timer = setTimeout(endSocket, SOCKET_TIMEOUT); | ||
return socket; | ||
@@ -42,5 +59,5 @@ } | ||
} | ||
off(endSocket); | ||
closing = true; | ||
socket && socket.close(derefSocket); | ||
process.off('exit', endSocket); | ||
} | ||
@@ -85,3 +102,2 @@ | ||
if (!teardown) { | ||
process.on('exit', endSocket); | ||
teardown = true; | ||
@@ -88,0 +104,0 @@ } |
{ | ||
"name": "@fiverr/statsd-client", | ||
"version": "1.0.7", | ||
"version": "1.0.8-rc-0f2c65b", | ||
"description": "📈 A feature packed, highly customisable StatsD client", | ||
@@ -38,13 +38,13 @@ "keywords": [ | ||
"devDependencies": { | ||
"@fiverr/eslint-config-fiverr": "^3.2.0", | ||
"@fiverr/eslint-config-fiverr": "^3.2.4", | ||
"@lets/wait": "^2.0.2", | ||
"chai": "^4.2.0", | ||
"chai": "^4.3.0", | ||
"chai-string": "^1.5.0", | ||
"eslint": "^7.13.0", | ||
"eslint-plugin-log": "^1.2.6", | ||
"mocha": "^8.2.1" | ||
"eslint": "^7.20.0", | ||
"eslint-plugin-log": "^1.2.7", | ||
"mocha": "^8.3.0" | ||
}, | ||
"publishConfig": { | ||
"tag": "latest" | ||
"tag": "kill-idle-sockets-rc" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
26803
18
694
1