From 9027fa8d507b0dae7f61b35899edf9fadda84147 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Jun 2021 10:48:12 -0400 Subject: [PATCH 1/3] Continue startup if tasks.json is corrupted --- libs/TaskManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/TaskManager.js b/libs/TaskManager.js index c0976df..81b90ee 100644 --- a/libs/TaskManager.js +++ b/libs/TaskManager.js @@ -158,7 +158,8 @@ class TaskManager{ try{ tasks = JSON.parse(data.toString()); }catch(e){ - done(new Error(`Could not load task list. It looks like the ${TASKS_DUMP_FILE} is corrupted (${e.message}). Please manually delete the file and try again.`)); + logger.warn(`Could not load task list. It looks like the ${TASKS_DUMP_FILE} is corrupted (${e.message}).`); + if (done !== undefined) done(); return; } From 5f0378089522d93839426178bdfcc4a08f79bd30 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Jun 2021 10:59:13 -0400 Subject: [PATCH 2/3] Retry move folder operation --- libs/taskNew.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libs/taskNew.js b/libs/taskNew.js index 1c80ef0..cccfc86 100644 --- a/libs/taskNew.js +++ b/libs/taskNew.js @@ -290,8 +290,26 @@ module.exports = { // Move all uploads to data//images dir (if any) cb => fs.mkdir(destPath, undefined, cb), cb => fs.mkdir(destGcpPath, undefined, cb), - cb => mv(srcPath, destImagesPath, cb), - + cb => { + // We attempt to do this multiple times, + // as antivirus software sometimes is scanning + // the folder while we try to move it, resulting in + // an operation not permitted error + let retries = 0; + + const move = () => { + mv(srcPath, destImagesPath, err => { + if (!err) cb(); // Done + else{ + if (++retries < 20){ + logger.warn(`Cannot move ${srcPath}, probably caused by antivirus software (please disable it or add an exception), retrying (${retries})...`); + setTimeout(2000, move); + }else cb(err); + } + }); + } + move(); + }, // Zip files handling cb => { const handleSeed = (cb) => { From c5b5fa0e5716716b882d7d6fe2e1f4c4b8c7b191 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Jun 2021 10:59:32 -0400 Subject: [PATCH 3/3] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18284d8..e13ffa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NodeODM", - "version": "2.1.8", + "version": "2.1.9", "description": "REST API to access ODM", "main": "index.js", "scripts": {