Skip to content

Commit

Permalink
Don't purge data tables until after schema update
Browse files Browse the repository at this point in the history
It's no longer necessary to do this before syncing, since tags and
creators aren't first-class objects.
  • Loading branch information
dstillman committed Sep 2, 2017
1 parent 69c27cd commit 1100015
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 6 additions & 0 deletions chrome/content/zotero/xpcom/zotero.js
Expand Up @@ -848,6 +848,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
Zotero.Feeds.init();
Zotero.addShutdownListener(() => Zotero.Feeds.uninit());

Zotero.Schema.schemaUpdatePromise.then(Zotero.purgeDataObjects.bind(Zotero));

return true;
}
catch (e) {
Expand Down Expand Up @@ -1987,6 +1989,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
* Clear entries that no longer exist from various tables
*/
this.purgeDataObjects = Zotero.Promise.coroutine(function* () {
var d = new Date();

yield Zotero.DB.executeTransaction(function* () {
return Zotero.Creators.purge();
});
Expand All @@ -2001,6 +2005,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
//yield Zotero.DB.executeTransaction(function* () {
// return Zotero.Relations.purge();
//});

Zotero.debug("Purged data tables in " + (new Date() - d) + " ms");
});


Expand Down
5 changes: 0 additions & 5 deletions chrome/content/zotero/zoteroPane.js
Expand Up @@ -414,11 +414,6 @@ var ZoteroPane = new function()
searchBar.inputField.select();
}, 1);

var d = new Date();
yield Zotero.purgeDataObjects();
var d2 = new Date();
Zotero.debug("Purged data tables in " + (d2 - d) + " ms");

// Auto-sync on pane open or if new account
if (Zotero.Prefs.get('sync.autoSync') || Zotero.initAutoSync) {
yield Zotero.proxyAuthComplete;
Expand Down

0 comments on commit 1100015

Please sign in to comment.