Don't purge data tables until after schema update

It's no longer necessary to do this before syncing, since tags and
creators aren't first-class objects.
This commit is contained in:
Dan Stillman 2017-09-01 17:46:20 -04:00
parent 69c27cd8a7
commit 1100015d2c
2 changed files with 6 additions and 5 deletions

View file

@ -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) {
@ -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();
});
@ -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");
});

View file

@ -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;