www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit b72f1c2a08014b74d689a99368f900d996868ddb
parent 9a3ff2d2446e9be269a3c4187bd5d255ce36393a
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  1 Jul 2017 06:22:57 -0400

Don't calculate total file size for every uploaded attachment

This required checking the file size of every file (including auxiliary
snapshot files) in every attachment to be uploaded, and it was an
estimate anyway, because snapshots are compressed, so we kept track of
the compression ratio, but there was no particular reason to think later
files would have the same ratio... In any case, we're not currently
displaying file sync progress in 5.0 anyway, and while we should, we can
probably just show a count of attachments remaining.

Diffstat:
Mchrome/content/zotero/xpcom/storage/storageEngine.js | 19+++----------------
1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/chrome/content/zotero/xpcom/storage/storageEngine.js b/chrome/content/zotero/xpcom/storage/storageEngine.js @@ -321,22 +321,9 @@ Zotero.Sync.Storage.Engine.prototype.queueItem = Zotero.Promise.coroutine(functi onProgress: this.onProgress }); if (type == 'upload') { - try { - request.setMaxSize(yield Zotero.Attachments.getTotalFileSize(item)); - } - // If this fails, ignore it, though we might fail later - catch (e) { - // But if the file doesn't exist yet, don't try to upload it - // - // This isn't a perfect test, because the file could still be in the process of being - // downloaded (e.g., from the web). It'd be better to download files to a temp - // directory and move them into place. - if (!(yield item.getFilePathAsync())) { - Zotero.debug("File " + item.libraryKey + " not yet available to upload -- skipping"); - return; - } - - Zotero.logError(e); + if (!(yield item.fileExists())) { + Zotero.debug("File " + item.libraryKey + " not yet available to upload -- skipping"); + return; } } this.queues[type].add(request.start.bind(request));