Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
removed market.pid lockfile creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Williams committed Jul 6, 2015
1 parent cdbfe5e commit bb81739
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions scripts/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,38 +59,50 @@ if (process.argv[2] == 'index') {
}

function create_lock(cb) {
var fname = './tmp/' + database + '.pid';
fs.appendFile(fname, process.pid, function (err) {
if (err) {
console.log("Error: unable to create %s", fname);
process.exit(1);
} else {
return cb();
}
});
if ( database == 'index' ) {
var fname = './tmp/' + database + '.pid';
fs.appendFile(fname, process.pid, function (err) {
if (err) {
console.log("Error: unable to create %s", fname);
process.exit(1);
} else {
return cb();
}
});
} else {
return cb();
}
}

function remove_lock(cb) {
var fname = './tmp/' + database + '.pid';
fs.unlink(fname, function (err){
if(err) {
console.log("unable to remove lock: %s", fname);
process.exit(1);
} else {
return cb();
}
});
if ( database == 'index' ) {
var fname = './tmp/' + database + '.pid';
fs.unlink(fname, function (err){
if(err) {
console.log("unable to remove lock: %s", fname);
process.exit(1);
} else {
return cb();
}
});
} else {
return cb();
}
}

function is_locked(cb) {
var fname = './tmp/' + database + '.pid';
fs.exists(fname, function (exists){
if(exists) {
return cb(true);
} else {
return cb(false);
}
});
if ( database == 'index' ) {
var fname = './tmp/' + database + '.pid';
fs.exists(fname, function (exists){
if(exists) {
return cb(true);
} else {
return cb(false);
}
});
} else {
return cb();
}
}

function exit() {
Expand Down

0 comments on commit bb81739

Please sign in to comment.