diff options
author | Phie <phie@phie.ovh> | 2020-05-31 17:49:25 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2020-05-31 17:49:25 +0300 |
commit | c2829085c99a6db863e3494a1708381dbfc6cfad (patch) | |
tree | f35de109a612b16c12b4d6ac1fb58bf1ae965318 /server | |
parent | 31a984328cf3e73f6335df614dde4ba230c2673a (diff) |
on failure set status for current item and parents only
Diffstat (limited to 'server')
-rw-r--r-- | server/sync/sync.js | 2 | ||||
-rw-r--r-- | server/sync/sync_db_manager.js | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/server/sync/sync.js b/server/sync/sync.js index fd8ad86..adc0a3e 100644 --- a/server/sync/sync.js +++ b/server/sync/sync.js @@ -638,7 +638,7 @@ Sync.prototype.visitRemote = function (path, callback) { callback() }).catch(function (err) { console.logDebug(err); - SyncDBManager.getInstance().setVisitStatus("failed") + SyncDBManager.getInstance().setVisitStatusForItemAndParent(correctPath(sync.nextcloudRoot, path), "failed") sync.exit(); }); } diff --git a/server/sync/sync_db_manager.js b/server/sync/sync_db_manager.js index 86f0418..c9f56b7 100644 --- a/server/sync/sync_db_manager.js +++ b/server/sync/sync_db_manager.js @@ -67,6 +67,25 @@ class SyncDBManager { } + setVisitStatusForItemAndParent(path, status) { + if (this.visitedDb[path] != undefined) { + this.visitedDb[path].status = status + console.log("setting status for " + path) + } + + const FileUtils = require('../../utils/file_utils').FileUtils; + var parentPath = FileUtils.getParentFolderFromPath(path) + while (parentPath != undefined && parentPath != path) { + path = parentPath; + if (this.visitedDb[path] != undefined) + this.visitedDb[path].status = status + parentPath = FileUtils.getParentFolderFromPath(path) + console.log("setting status parent for " + path) + } + this.store.set("nextcloud_visited_db", JSON.stringify(this.visitedDb)); + + } + static getInstance() { if (SyncDBManager.staticManager == undefined) { SyncDBManager.staticManager = new SyncDBManager(); |