1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

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.
This commit is contained in:
Raymond Hill 2023-03-27 15:04:44 -04:00
parent 10f9559a52
commit 885b3ea6c0
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 10 additions and 4 deletions

View File

@ -50,7 +50,7 @@ const hiddenSettingsDefault = {
autoCommentFilterTemplate: '{{date}} {{origin}}',
autoUpdateAssetFetchPeriod: 60,
autoUpdateDelayAfterLaunch: 105,
autoUpdatePeriod: 4,
autoUpdatePeriod: 2,
benchmarkDatasetURL: 'unset',
blockingProfiles: '11111/#F00 11010/#C0F 11001/#00F 00001',
cacheStorageAPI: 'unset',

View File

@ -1481,9 +1481,13 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
const now = Date.now();
let needEmergencyUpdate = false;
for ( const asset of Object.values(assetDict) ) {
for ( const [ assetKey, asset ] of Object.entries(assetDict) ) {
if ( asset.hasRemoteURL !== true ) { continue; }
if ( asset.content === 'filters' && asset.off === true ) { continue; }
if ( asset.content === 'filters' ) {
if ( µb.selectedFilterLists.includes(assetKey) === false ) {
continue;
}
}
if ( asset.obsolete !== true ) { continue; }
const lastUpdateInDays = (now - asset.writeTime) / 86400000;
const daysSinceVeryObsolete = lastUpdateInDays - 2 * asset.updateAfter;
@ -1602,7 +1606,9 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
this.loadFilterLists();
}
if ( this.userSettings.autoUpdate ) {
this.scheduleAssetUpdater(this.hiddenSettings.autoUpdatePeriod * 3600000 || 25200000);
this.scheduleAssetUpdater(
this.hiddenSettings.autoUpdatePeriod * 3600000 || 25200000
);
} else {
this.scheduleAssetUpdater(0);
}