kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Code cleanup
rodzic
6e56c31ab1
commit
032e20f390
4
index.js
4
index.js
|
@ -159,7 +159,7 @@ app.get('/getOptions', (req, res) => {
|
|||
|
||||
let gracefulShutdown = done => {
|
||||
async.series([
|
||||
cb => { taskManager.dumpTaskList(cb); },
|
||||
cb => taskManager.dumpTaskList(cb),
|
||||
cb => {
|
||||
console.log("Closing server");
|
||||
server.close();
|
||||
|
@ -180,7 +180,7 @@ let taskManager;
|
|||
let server;
|
||||
|
||||
async.series([
|
||||
cb => { taskManager = new TaskManager(cb); },
|
||||
cb => taskManager = new TaskManager(cb),
|
||||
cb => { server = app.listen(3000, err => {
|
||||
if (!err) console.log('Server has started on port 3000');
|
||||
cb(err);
|
||||
|
|
|
@ -33,8 +33,8 @@ module.exports = class TaskManager{
|
|||
this.runningQueue = [];
|
||||
|
||||
async.series([
|
||||
cb => { this.restoreTaskListFromDump(cb); },
|
||||
cb => { this.removeOldTasks(cb); },
|
||||
cb => this.restoreTaskListFromDump(cb),
|
||||
cb => this.removeOldTasks(cb),
|
||||
cb => {
|
||||
this.processNextTask();
|
||||
cb();
|
||||
|
@ -136,9 +136,7 @@ module.exports = class TaskManager{
|
|||
removeFromRunningQueue(task){
|
||||
assert(task.constructor.name === "Task", "Must be a Task object");
|
||||
|
||||
this.runningQueue = this.runningQueue.filter(t => {
|
||||
return t !== task;
|
||||
});
|
||||
this.runningQueue = this.runningQueue.filter(t => t !== task);
|
||||
}
|
||||
|
||||
addNew(task){
|
||||
|
|
|
@ -170,7 +170,7 @@ module.exports = {
|
|||
function checkDomain(domain, value){
|
||||
let dc, matches;
|
||||
|
||||
if (dc = domainChecks.find(dc => { return matches = domain.match(dc.regex); })){
|
||||
if (dc = domainChecks.find(dc => matches = domain.match(dc.regex))){
|
||||
if (!dc.validate(matches, value)) throw new Error(`Invalid value ${value} (out of range)`);
|
||||
}else{
|
||||
throw new Error(`Domain value cannot be handled: '${domain}' : '${value}'`);
|
||||
|
@ -181,7 +181,7 @@ module.exports = {
|
|||
for (let odmOption of odmOptions){
|
||||
// Was this option selected by the user?
|
||||
let opt;
|
||||
if (opt = options.find(o => { return o.name === odmOption.name; })){
|
||||
if (opt = options.find(o => o.name === odmOption.name)){
|
||||
try{
|
||||
// Convert to proper data type
|
||||
let value = typeConversion[odmOption.type](opt.value);
|
||||
|
|
|
@ -31,17 +31,11 @@ module.exports = {
|
|||
], {cwd: ODM_PATH});
|
||||
|
||||
childProcess
|
||||
.on('exit', (code, signal) => {
|
||||
done(null, code, signal);
|
||||
})
|
||||
.on('exit', (code, signal) => done(null, code, signal))
|
||||
.on('error', done);
|
||||
|
||||
childProcess.stdout.on('data', chunk => {
|
||||
outputReceived(chunk.toString());
|
||||
});
|
||||
childProcess.stderr.on('data', chunk => {
|
||||
outputReceived(chunk.toString());
|
||||
});
|
||||
childProcess.stdout.on('data', chunk => outputReceived(chunk.toString()));
|
||||
childProcess.stderr.on('data', chunk => outputReceived(chunk.toString()));
|
||||
|
||||
return childProcess;
|
||||
},
|
||||
|
@ -63,9 +57,7 @@ module.exports = {
|
|||
})
|
||||
.on('error', done);
|
||||
|
||||
let processOutput = chunk => {
|
||||
output.push(chunk.toString());
|
||||
};
|
||||
let processOutput = chunk => output.push(chunk.toString());
|
||||
|
||||
childProcess.stdout.on('data', processOutput);
|
||||
childProcess.stderr.on('data', processOutput);
|
||||
|
|
Ładowanie…
Reference in New Issue