diff --git a/localassetmanager.js b/localassetmanager.js index ef78a95..cef5de8 100644 --- a/localassetmanager.js +++ b/localassetmanager.js @@ -2,6 +2,9 @@ 'use strict'; function getLocalItem(serverId, itemId) { + + console.log('[lcoalassetmanager] Begin getLocalItem'); + return itemrepository.get(serverId, itemId); } @@ -397,6 +400,8 @@ function createLocalItem(libraryItem, serverInfo, jobItem) { + console.log('[lcoalassetmanager] Begin createLocalItem'); + var path = getDirectoryPath(libraryItem, serverInfo); var localFolder = filerepository.getFullLocalPath(path); diff --git a/sync/localsync.js b/sync/localsync.js index 88f5aae..f1e3a5a 100644 --- a/sync/localsync.js +++ b/sync/localsync.js @@ -28,10 +28,10 @@ isSyncing = null; resolve(); - }, function () { + }, function (err) { isSyncing = null; - reject(); + reject(err); }); }); diff --git a/sync/multiserversync.js b/sync/multiserversync.js index e40ddb0..ec28edf 100644 --- a/sync/multiserversync.js +++ b/sync/multiserversync.js @@ -17,9 +17,13 @@ new ServerSync().sync(connectionManager, server, options).then(function () { + console.log("ServerSync succeeded to server: " + server.Id); + syncNext(connectionManager, servers, index + 1, options, resolve, reject); - }, function () { + }, function (err) { + + console.log("ServerSync failed to server: " + server.Id + '. ' + err); syncNext(connectionManager, servers, index + 1, options, resolve, reject); }); diff --git a/sync/serversync.js b/sync/serversync.js index 6d8db25..e7658aa 100644 --- a/sync/serversync.js +++ b/sync/serversync.js @@ -13,23 +13,14 @@ uploadPhotos = false; } - var pr = Promise.resolve(); + var promise = uploadPhotos ? uploadContent(connectionManager, server, options) : Promise.resolve(); - return pr.then(function () { - - if (uploadPhotos) { - return uploadContent(connectionManager, server, options); - } - - return Promise.resolve(); - - }).then(function () { + return promise.then(function () { return syncMedia(connectionManager, server, options); }); } - function uploadContent(connectionManager, server, options) { return new Promise(function (resolve, reject) {