1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-30 19:22:11 +00:00
This commit is contained in:
Julien Voisin 2025-09-30 14:50:19 +00:00 committed by GitHub
commit 62c01abfbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 5 deletions

View file

@ -489,8 +489,8 @@ func NewConfigOptions() *configOptions {
}, },
}, },
"POLLING_PARSING_ERROR_LIMIT": { "POLLING_PARSING_ERROR_LIMIT": {
ParsedIntValue: 3, ParsedIntValue: 0,
RawValue: "3", RawValue: "0",
ValueType: intType, ValueType: intType,
Validator: func(rawValue string) error { Validator: func(rawValue string) error {
return validateGreaterOrEqualThan(rawValue, 0) return validateGreaterOrEqualThan(rawValue, 0)

View file

@ -1058,8 +1058,8 @@ func TestPollingLimitPerHostOptionParsing(t *testing.T) {
func TestPollingParsingErrorLimitOptionParsing(t *testing.T) { func TestPollingParsingErrorLimitOptionParsing(t *testing.T) {
configParser := NewConfigParser() configParser := NewConfigParser()
if configParser.options.PollingParsingErrorLimit() != 3 { if configParser.options.PollingParsingErrorLimit() != 0 {
t.Fatalf("Expected POLLING_PARSING_ERROR_LIMIT to be 3 by default") t.Fatalf("Expected POLLING_PARSING_ERROR_LIMIT to be 0 by default")
} }
if err := configParser.parseLines([]string{"POLLING_PARSING_ERROR_LIMIT=5"}); err != nil { if err := configParser.parseLines([]string{"POLLING_PARSING_ERROR_LIMIT=5"}); err != nil {

View file

@ -6,6 +6,7 @@ package model // import "miniflux.app/v2/internal/model"
import ( import (
"fmt" "fmt"
"io" "io"
"math"
"time" "time"
"miniflux.app/v2/internal/config" "miniflux.app/v2/internal/config"
@ -135,6 +136,16 @@ func (f *Feed) ScheduleNextCheck(weeklyCount int, refreshDelay time.Duration) ti
// Use the RSS TTL field, Retry-After, Cache-Control or Expires HTTP headers if defined. // Use the RSS TTL field, Retry-After, Cache-Control or Expires HTTP headers if defined.
interval = max(interval, refreshDelay) interval = max(interval, refreshDelay)
// Use a binary exponential backoff for feeds with parsing errors.
// https://en.wikipedia.org/wiki/Exponential_backoff
if f.ParsingErrorCount > 0 {
backoff := time.Duration(math.Pow(2, float64(f.ParsingErrorCount))) * time.Hour
// Set a hard limit at one week
if backoff.Hours() < time.Hour.Hours()*24*7 {
interval += backoff
}
}
// Limit the max interval value for misconfigured feeds. // Limit the max interval value for misconfigured feeds.
switch config.Opts.PollingScheduler() { switch config.Opts.PollingScheduler() {
case SchedulerRoundRobin: case SchedulerRoundRobin:

View file

@ -504,7 +504,7 @@ The maximum number of parsing errors that the program will try before stopping p
.br .br
Once the limit is reached, the user must refresh the feed manually. Set to 0 for unlimited. Once the limit is reached, the user must refresh the feed manually. Set to 0 for unlimited.
.br .br
Default is 3\&. Default is 0\&.
.TP .TP
.B POLLING_SCHEDULER .B POLLING_SCHEDULER
Determines the strategy used to schedule feed polling. Determines the strategy used to schedule feed polling.