Merge pull request #1757 from kafji/kfj/fix-sync-hog

Fix sync resource hog
This commit is contained in:
Andrea Marchesini 2021-10-25 16:59:59 +02:00 committed by GitHub
commit e830a5bcd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -89,13 +89,13 @@ window.assignManager = {
return; return;
}, },
async remove(pageUrlorUrlKey) { async remove(pageUrlorUrlKey, shouldSync = true) {
const siteStoreKey = this.getSiteStoreKey(pageUrlorUrlKey); const siteStoreKey = this.getSiteStoreKey(pageUrlorUrlKey);
// When we remove an assignment we should clear all the exemptions // When we remove an assignment we should clear all the exemptions
this.removeExempted(pageUrlorUrlKey); this.removeExempted(pageUrlorUrlKey);
await this.area.remove([siteStoreKey]); await this.area.remove([siteStoreKey]);
const syncEnabled = await this.getSyncEnabled(); const syncEnabled = await this.getSyncEnabled();
if (syncEnabled) await sync.storageArea.backup({siteStoreKey}); if (shouldSync && syncEnabled) await sync.storageArea.backup({siteStoreKey});
return; return;
}, },

View file

@ -493,9 +493,9 @@ async function reconcileSiteAssignments() {
await sync.storageArea.getDeletedSiteList(); await sync.storageArea.getDeletedSiteList();
for(const siteStoreKey of deletedSiteList) { for(const siteStoreKey of deletedSiteList) {
if (Object.prototype.hasOwnProperty.call(assignedSitesLocal,siteStoreKey)) { if (Object.prototype.hasOwnProperty.call(assignedSitesLocal,siteStoreKey)) {
assignManager await assignManager
.storageArea .storageArea
.remove(siteStoreKey); .remove(siteStoreKey, false);
} }
} }