Wait for DB transaction to end before indexing string

This might help avoid timeouts during indexing.

Addresses #1284
This commit is contained in:
Dan Stillman 2018-03-01 01:11:43 -05:00
parent 1cfc90186f
commit b50b055e44

View file

@ -261,6 +261,10 @@ Zotero.Fulltext = Zotero.FullText = new function(){
var indexString = Zotero.Promise.coroutine(function* (text, charset, itemID, stats, version, synced) { var indexString = Zotero.Promise.coroutine(function* (text, charset, itemID, stats, version, synced) {
var words = this.semanticSplitter(text, charset); var words = this.semanticSplitter(text, charset);
while (Zotero.DB.inTransaction()) {
yield Zotero.DB.waitForTransaction('indexString()');
}
yield Zotero.DB.executeTransaction(function* () { yield Zotero.DB.executeTransaction(function* () {
this.clearItemWords(itemID, true); this.clearItemWords(itemID, true);
yield indexWords(itemID, words, stats, version, synced); yield indexWords(itemID, words, stats, version, synced);