Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cluster-file-writer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cluster-file-writer - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

35

lib/ClusterFileWriter.js

@@ -6,17 +6,6 @@ var fs = require('fs');

var self = this;
this._log = fs.createWriteStream(path);
this._pausedWorkers = [];
this._log.on('drain', function () {
this.setupFile(path);
try {
while(self._pausedWorkers.length > 0) {
var worker = self._pausedWorkers.pop();
worker.send('cluster-file-writer-resume');
}
} catch (e) {
console.log(e);
}
});
this.messagesWritten = 0;

@@ -52,2 +41,24 @@ this.workersCount = 0;

Master.prototype.setupFile = function(path) {
var self = this;
if (this._log) {
this._log.end();
}
this.currentPath = path;
this._log = fs.createWriteStream(path);
this._log.on('drain', function () {
try {
while(self._pausedWorkers.length > 0) {
var worker = self._pausedWorkers.pop();
worker.send('cluster-file-writer-resume');
}
} catch (e) {
console.log(e);
}
});
}
Master.prototype._handleIncomingMessages = function (worker) {

@@ -54,0 +65,0 @@ var self = this;

{
"name": "cluster-file-writer",
"version": "0.0.5",
"version": "0.0.6",
"description": "write to a single file from a cluster",

@@ -5,0 +5,0 @@ "keywords": ["cluster", "logger", "filesystem", "file"],

@@ -26,2 +26,8 @@ var assert = require('assert');

// setTimeout(function () {
// console.log('switching files');
// writer.setupFile('test2.log');
// }, 10000);
var ref = setInterval(function() {

@@ -31,2 +37,3 @@ if (lastMW > 0) {

}

@@ -33,0 +40,0 @@ lastMW = writer.messagesWritten;

Sorry, the diff of this file is not supported yet

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