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

fslockjs

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fslockjs - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

.github/workflows/nodejs.yml

2

package.json
{
"name": "fslockjs",
"version": "2.0.0",
"version": "2.0.1",
"description": "Easy to use file system queue with locking and events. Provide Asynchronous utilities for Directories and File",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,1 +1,6 @@

# 2.0.1
- impr: improve queue processing for big queue (00c80b14475bf82e9f8b1344d451a43997c76b9f)
- impr: proper warning on incorrect command (a9016a0657cadd2a1d02ea7ee03bc95e4def8bb0)
# 2.0.0

@@ -2,0 +7,0 @@

@@ -37,3 +37,3 @@ const url = require('url');

const newURL = response.headers.location;
console.log('Redirect to', newURL);
// console.log('Redirect to', newURL);
// throw("Moved to ",newURL)

@@ -40,0 +40,0 @@ return resolve(this.download(newURL, outputPath));

@@ -42,3 +42,2 @@ const {expect} = require('chai');

expect(job3.state).to.equal('executed');
console.log(job3)
expect(job3.result).to.equal(true);

@@ -45,0 +44,0 @@ });

@@ -9,2 +9,8 @@ const File = require('../../../File/File');

const [type,fn] = command.split('.');
if(!utils[type]){
throw new Error(`Not handled type ${type} - Expected one of ${Object.keys(utils)}`)
}
if(!utils[type][fn]){
throw new Error(`Not handled method ${type}.${fn} - Expected one of ${Object.keys(utils[type])}`)
}
result = await utils[type][fn](path, params);

@@ -11,0 +17,0 @@ } catch(e){

@@ -1,15 +0,10 @@

const {map} = require('lodash');
const { map } = require('lodash');
const next = async (self)=>{
if(self.options.autoexec && !self.autoExecStarted){
return;
}
await self.processNext()
}
const processQueue = async (self)=>{
if(self.queue.length>0){
await next(self);
const processQueue = async (self) => {
if (self.queue.length > 0) {
await self.processNext();
// We check if there is other tasks to perform
await processQueue(self);
}
}
};

@@ -19,5 +14,11 @@ module.exports = async function processAll() {

const self = this;
if (this.queue.length === 0) return;
if (this.queue.length === 0) {
this.state = 'idle';
return;
}
if (self.options.autoexec && !self.autoExecStarted) {
return;
}
await processQueue(self);
this.state = 'idle';
};

@@ -52,11 +52,7 @@ const execCommand = require('./ops/execCommand');

job.emit('executed');
this.state = 'idle';
// FIXME : Actually, it works without this, but I saw cases where .exists was returning false
// Keeping this except requested otherwise
setTimeout(()=>{
delete self.locks[path]
self.state = 'idle';
resolve(true);
}, 20);
delete self.locks[path];
return resolve(true);
})
};

@@ -6,3 +6,5 @@ module.exports = function start() {

const continuouslyExecute = () => {
if (self.state === 'processingAll') {
return;
}
self.processAll()

@@ -12,8 +14,8 @@ .then(() => {

setTimeout(() => {
continuouslyExecute();
}, 50)
continuouslyExecute();
}, 20)
}
})
}
continuouslyExecute();
continuouslyExecute();
}
module.exports = function stop() {
if(this.state=='idle' || !this.autoExecStarted) return false;
if(!this.autoExecStarted) return false;
this.autoExecStarted = false;
}
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