зеркало из https://github.com/github/node-statsd.git
Two Fixes:
1. client was instantiated twice, but closed once, leading to a ulimit issue 2. if there was more than one stat to send, client may be closed too soon. it's easier to create a new client for each send.
This commit is contained in:
Родитель
e6979e9b3c
Коммит
8abe625262
|
@ -44,8 +44,6 @@ Client.prototype.send = function (data, sample_rate) {
|
|||
if (!sample_rate) {
|
||||
sample_rate = 1;
|
||||
}
|
||||
|
||||
var client = dgram.createSocket('udp4');
|
||||
|
||||
sampled_data = {};
|
||||
if(sample_rate < 1) {
|
||||
|
@ -59,8 +57,8 @@ Client.prototype.send = function (data, sample_rate) {
|
|||
else {
|
||||
sampled_data=data;
|
||||
}
|
||||
var client = dgram.createSocket('udp4');
|
||||
for (stat in sampled_data) {
|
||||
var client = dgram.createSocket('udp4');
|
||||
send_data = stat+":"+sampled_data[stat];
|
||||
send_data = new Buffer(send_data);
|
||||
client.send(send_data, 0, send_data.length, self.port, self.host,
|
||||
|
|
Загрузка…
Ссылка в новой задаче