Skip to content

Commit 885b3ea

Browse files
committed
Fix spurious update cycle attempts
Caused by the fact that external filter lists do not have an `off` property even when they are not enabled. Additionally, set the default update cycle check period to 2hr.
1 parent 10f9559 commit 885b3ea

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/js/background.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const hiddenSettingsDefault = {
5050
autoCommentFilterTemplate: '{{date}} {{origin}}',
5151
autoUpdateAssetFetchPeriod: 60,
5252
autoUpdateDelayAfterLaunch: 105,
53-
autoUpdatePeriod: 4,
53+
autoUpdatePeriod: 2,
5454
benchmarkDatasetURL: 'unset',
5555
blockingProfiles: '11111/#F00 11010/#C0F 11001/#00F 00001',
5656
cacheStorageAPI: 'unset',

src/js/storage.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1481,9 +1481,13 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
14811481
const now = Date.now();
14821482

14831483
let needEmergencyUpdate = false;
1484-
for ( const asset of Object.values(assetDict) ) {
1484+
for ( const [ assetKey, asset ] of Object.entries(assetDict) ) {
14851485
if ( asset.hasRemoteURL !== true ) { continue; }
1486-
if ( asset.content === 'filters' && asset.off === true ) { continue; }
1486+
if ( asset.content === 'filters' ) {
1487+
if ( µb.selectedFilterLists.includes(assetKey) === false ) {
1488+
continue;
1489+
}
1490+
}
14871491
if ( asset.obsolete !== true ) { continue; }
14881492
const lastUpdateInDays = (now - asset.writeTime) / 86400000;
14891493
const daysSinceVeryObsolete = lastUpdateInDays - 2 * asset.updateAfter;
@@ -1602,7 +1606,9 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
16021606
this.loadFilterLists();
16031607
}
16041608
if ( this.userSettings.autoUpdate ) {
1605-
this.scheduleAssetUpdater(this.hiddenSettings.autoUpdatePeriod * 3600000 || 25200000);
1609+
this.scheduleAssetUpdater(
1610+
this.hiddenSettings.autoUpdatePeriod * 3600000 || 25200000
1611+
);
16061612
} else {
16071613
this.scheduleAssetUpdater(0);
16081614
}

0 commit comments

Comments
 (0)