From b50b055e442d0e24ec477e6d6f45034cd397c8cb Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 1 Mar 2018 01:11:43 -0500 Subject: [PATCH] Wait for DB transaction to end before indexing string This might help avoid timeouts during indexing. Addresses #1284 --- chrome/content/zotero/xpcom/fulltext.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index 05726c563a..67358f5ed0 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -261,6 +261,10 @@ Zotero.Fulltext = Zotero.FullText = new function(){ var indexString = Zotero.Promise.coroutine(function* (text, charset, itemID, stats, version, synced) { var words = this.semanticSplitter(text, charset); + while (Zotero.DB.inTransaction()) { + yield Zotero.DB.waitForTransaction('indexString()'); + } + yield Zotero.DB.executeTransaction(function* () { this.clearItemWords(itemID, true); yield indexWords(itemID, words, stats, version, synced);