mirror of
https://github.com/miniflux/v2.git
synced 2025-09-30 19:22:11 +00:00
Merge 63b1279792
into 8adcaed29e
This commit is contained in:
commit
62c01abfbb
4 changed files with 16 additions and 5 deletions
|
@ -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)
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue