New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-logging

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-logging - npm Package Compare versions

Comparing version 0.1.14 to 0.1.15

7

lib/log-cluster.js

@@ -50,3 +50,6 @@ 'use strict';

'cleanDuration' : 1000 * 60,//one min
'machineName' : os.hostname()
'machineName' : os.hostname(),
'maxLife' : 1000 * 3600 * 2, //two hours
'maxMessages' : 3600, //0.5 msg/pec, 2 hours
'waitForPublisher': 3000//3s
};

@@ -78,3 +81,3 @@ //let user options overwrite defaults

//either a constructor or an instance
_.isFunction(actualOptions.LogListener) ? actualOptions.LogListener(wss, emitter, actualOptions.app, actualOptions.middleware, actualOptions.machineName) : actualOptions.LogListener;
_.isFunction(actualOptions.LogListener) ? actualOptions.LogListener(wss, emitter, actualOptions) : actualOptions.LogListener;
_.isFunction(actualOptions.LogBuffer) ? actualOptions.LogBuffer(emitter) : actualOptions.LogBuffer;

@@ -81,0 +84,0 @@ _.isFunction(actualOptions.LogPublisher) ? actualOptions.LogPublisher(emitter) : actualOptions.LogPublisher;

@@ -21,5 +21,51 @@ 'use strict';

var LogListener = exports.LogListener = function(wss, emitter, app, middleware, machineName){
var LogListener = exports.LogListener = function(wss, emitter, options){
var _this = this;
var _this = this,
app = options.app,
middleware = options.middleware,
machineName = options.machineName,
totalMessages = 0,
maxMessages = options.maxMessages,
waitForPublisher = options.waitForPublisher || 2000,//2 sec
maxLife = options.maxLife,
suicide = _.once(function suicide(){
wss.shutDown();
function wait(retries){
if(_this.connections.length === 0 || retries === 0){
var publisherTimeout = setTimeout(function(){
console.log('forced suicide:' + process.pid);
process.exit(-1);
},
waitForPublisher);
emitter.emit('clean', Date.now());//force everything in the buffer to be flushed
emitter.emit('clean', Date.now());
emitter.emit('clean', Date.now());//emit 3 times to make sure it exceeds the max age of buffered transactions too
emitter.once('suicide-confirmed-by-publisher', function(){
console.log('gracefully suicide:' + process.pid);
clearTimeout(publisherTimeout);
process.exit(-1);
});
emitter.emit('suicide-wait-for-publisher');
}
else{
//wait for cluster to revive me
setTimeout(function(){
wait(retries - 1);
}, 1000);//try in 1 second
}
}
wait(5);//max 5s shutdown flow
});
_this.connections = [];

@@ -72,2 +118,8 @@

connection.lastMessageReceivedAt = Date.now();
totalMessages += 1;
if(totalMessages >= maxMessages){
suicide();
}
}

@@ -94,2 +146,6 @@ });

if(maxLife){
setTimeout(suicide, maxLife);
}
if(app){

@@ -127,2 +183,3 @@

}
};
};
{
"author": "cubejs",
"name": "async-logging",
"version": "0.1.14",
"version": "0.1.15",
"description": "0.1.6 is the same as 0.2.2 just to get around ebay-logging-client vs. async-logging-client change",

@@ -6,0 +6,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc