www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit ee8c60939a1848d85047c64d73893b55d1f461a0
parent b87b46aa953d6527cd1c034fe6acd35705b6a22e
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 28 Jun 2010 16:54:06 +0000

open a transaction for translatorCache updates


Diffstat:
Mchrome/content/zotero/xpcom/translate.js | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/translate.js b/chrome/content/zotero/xpcom/translate.js @@ -49,7 +49,8 @@ Zotero.Translators = new function() { this.init = function() { _initialized = true; - var start = (new Date()).getTime() + var start = (new Date()).getTime(); + var transactionStarted = false; _cache = {"import":[], "export":[], "web":[], "search":[]}; _translators = {}; @@ -104,6 +105,10 @@ Zotero.Translators = new function() { if(!dbCacheEntry) { // Add cache misses to DB + if(!transactionStarted) { + transactionStarted = true; + Zotero.DB.beginTransaction(); + } Zotero.Translators.cacheInDB(leafName, translator.metadataString, translator.cacheCode ? translator.code : null, lastModifiedTime); delete translator.metadataString; } @@ -120,6 +125,11 @@ Zotero.Translators = new function() { } } + // Close transaction + if(transactionStarted) { + Zotero.DB.commitTransaction(); + } + // Sort by priority var collation = Zotero.getLocaleCollation(); var cmp = function (a, b) {