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.
This commit is contained in:
parent
9a3ff2d244
commit
b72f1c2a08
1 changed files with 3 additions and 16 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue