commit b50b055e442d0e24ec477e6d6f45034cd397c8cb
parent 1cfc90186f44f9325f2cf6b15894083f814373bd
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 1 Mar 2018 01:11:43 -0500
Wait for DB transaction to end before indexing string
This might help avoid timeouts during indexing.
Addresses #1284
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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);