open a transaction for translatorCache updates
This commit is contained in:
parent
b87b46aa95
commit
ee8c60939a
1 changed files with 11 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue