Mark items with missing full-text cache files as unsynced for full text

Fixes #954, Full-text content processor tries to process missing cache
files on every idle
This commit is contained in:
Dan Stillman 2016-05-15 01:30:35 -04:00
parent 82d00a4e7a
commit a7ea92fd52

View file

@ -1038,6 +1038,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
}
/**
* Find items marked as having unprocessed cache files, run cache file processing on one item, and
* after a short delay call self again with the remaining items
*
* @param {Array<Integer>} itemIDs An array of itemIDs to process; if this
* is omitted, a database query is made
@ -1076,6 +1078,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
yield Zotero.Fulltext.indexFromProcessorCache(itemID);
// If there are remaining items, call self again after a short delay. The delay allows for
// processing to be interrupted if the user returns from idle
if (itemIDs.length) {
if (!_processorTimer) {
_processorTimer = Components.classes["@mozilla.org/timer;1"]
@ -1119,6 +1123,9 @@ Zotero.Fulltext = Zotero.FullText = new function(){
var cacheFile = this.getItemProcessorCacheFile(item);
if (!cacheFile.exists()) {
Zotero.debug("Full-text content processor cache file doesn't exist for item " + itemID);
yield Zotero.DB.queryAsync(
"UPDATE fulltextItems SET synced=? WHERE itemID=?", [SYNC_STATE_UNSYNCED, itemID]
);
return false;
}