From deffa464e38881342d42d0a55f04fd052791de94 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 17 Nov 2013 14:04:26 -0500 Subject: [PATCH] Don't try more than 5 times to fill 500K limit This will hopefully fix freezes during full-text syncs. --- chrome/content/zotero/xpcom/fulltext.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index 4e411bfaee..3188b04f8c 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -595,6 +595,8 @@ Zotero.Fulltext = new function(){ + " ORDER BY clientDateModified DESC"; var rows = Zotero.DB.query(sql) || []; var libraryIsEditable = {}; + var skips = 0; + var maxSkips = 5; for each (let row in rows) { let text; let itemID = row.itemID; @@ -669,6 +671,11 @@ Zotero.Fulltext = new function(){ // If this isn't the first item and it would put us over the limit, // skip it if (!first && maxChars && ((chars + text.length) > maxChars)) { + // Don't try more than maxSkips times to fill up to the limit + skips++; + if (skips == maxSkips) { + break; + } continue; } chars += text.length;