Authored by 周奇琪

升级版本号,修改发送异常的事件名称

... ... @@ -13,7 +13,13 @@ const sender = new Sender({
let num = 1;
let num2 = 1;
setInterval(() => {
if (num > 10000) {
console.log('1 done!');
return;
}
sender.addMessage({
tags: {
reqid: num + '',
... ... @@ -25,3 +31,21 @@ setInterval(() => {
});
num++;
}, Math.random() * 10);
setInterval(() => {
if (num2 > 10000) {
console.log('2 done!');
return;
}
sender.addMessage({
tags: {
reqid: num2 + '',
route: 'test2'
},
fields: {
dasd: '12131'
}
});
num2++;
}, Math.random() * 10);
\ No newline at end of file
... ...
... ... @@ -137,14 +137,13 @@ class Sender extends EventEmitter {
console.error(`Send failed! statusCode:${res.statusCode}`);
this.emit('failed', res.statusCode);
} else {
console.log('status code:' + res.statusCode);
this.emit('ok', res.statusCode);
}
});
req.on('error', (e) => {
debug('send error: %O', e);
this.emit('error', e);
this.emit('sendError', e);
console.error(e);
});
... ...
{
"name": "influx-batch-sender",
"version": "0.1.2",
"version": "0.1.3",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/nyc node_modules/.bin/ava",
... ...