From d76cf829b1d0921ad4c06ab651458d2319435ba1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 20 Dec 2021 21:33:59 -0500 Subject: [PATCH] Additional logging for PDF annotation import --- chrome/content/zotero/xpcom/pdfWorker/manager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/pdfWorker/manager.js b/chrome/content/zotero/xpcom/pdfWorker/manager.js index d68ba0a02a..3b9a40932c 100644 --- a/chrome/content/zotero/xpcom/pdfWorker/manager.js +++ b/chrome/content/zotero/xpcom/pdfWorker/manager.js @@ -237,12 +237,17 @@ class PDFWorker { async import(itemID, isPriority, password, transfer) { return this._enqueue(async () => { let attachment = await Zotero.Items.getAsync(itemID); + + Zotero.debug("Importing annotations for item " + attachment.libraryKey); + let t = new Date(); + if (!attachment.isPDFAttachment()) { throw new Error('Item must be a PDF attachment'); } let mtime = Math.floor(await attachment.attachmentModificationTime / 1000); if (!transfer && attachment.attachmentLastProcessedModificationTime === mtime) { + Zotero.debug("File hasn't changed since last-processed time -- skipping annotations import"); return false; } @@ -311,7 +316,10 @@ class PDFWorker { attachment.attachmentLastProcessedModificationTime = mtime; await attachment.saveTx({ skipDateModifiedUpdate: true }); - + + Zotero.debug(`Imported ${imported.length} annotation(s) for item ${attachment.libraryKey} ` + + `in ${new Date() - t} ms`); + return !!(imported.length || deleted.length); }, isPriority); }