Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(function (resolve, reject) {
var lockPath = getLockPath(file);
/* eslint-disable consistent-return */
lockfile.unlock(lockPath, function (err) {
if (err) {
return reject(err);
}
resolve();
});
});
};
fs.appendFile(analyticsFile,temp,function (err,result){
if(err){
logs =temp+logs;
num_rows +=currentNrOfRows
}
lockFile.unlock(analyticsFile + ".lock", function (err) {
if (err) {
console.error("Analytics error on unlocking!", err);
}
});
});
}
var unlock = function() {
lockfile.unlock(lockFile, function(error) {
if (error) {
console.error(error);
}
});
};
store.close = function close(returnError) {
jsonpatch.unobserve(store.data, observer);
lockFile.unlock(storePath + LOCK_FILE_EXTENSION, function (error) {
if (error) {
error.stacktrace = new Error().stack;
store.emit('error', error);
if (returnError) { returnError(error); } else { throw error; }
return;
}
store.emit('closed');
returnError && returnError();
});
};
return new Promise(function(resolve2,reject2) {
lockfile.unlock(lock_fname,function(err) {
if (err) {
reject2(err);
return;
}
resolve2();
});
});
}
}, function (error, results) {
lockFile.unlock(mutexPath, function (unlockError) {
if (unlockError) {
returnErrorAndObject(unlockError);
return;
}
returnErrorAndObject(error, results.applyPatches);
});
});
};
finish: function(error, cache) {
lockFile.unlock(this.cacheLockPath, function(error) {
this.updateCallback(error, cache);
}.bind(this));
},
store.close = function close(returnError) {
jsonpatch.unobserve(store.data, observer);
lockFile.unlock(path + LOCK_FILE_EXTENSION, function (error) {
if (error) {
if (returnError) { returnError(error); } else { throw error; }
return;
}
returnError && returnError();
});
};
function unlock (u, cb) {
var lf = lockFileName(u)
if (!myLocks[lf]) return process.nextTick(cb)
myLocks[lf] = false
lockFile.unlock(lockFileName(u), cb)
}
function unlock (u, cb) {
var lf = lockFileName(u)
if (!myLocks[lf]) return process.nextTick(cb)
myLocks[lf] = false
lockFile.unlock(lockFileName(u), cb)
}