1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-31 18:31:01 +00:00

Add SCHEDULER_ROUND_ROBIN_MIN_INTERVAL

Separated from POLLING_FREQUENCY.
This commit is contained in:
Shizun Ge 2023-11-28 21:14:10 -08:00 committed by Frédéric Guillot
parent fe0ef8b579
commit 70b69ecd19
6 changed files with 76 additions and 1 deletions

View file

@ -83,6 +83,31 @@ func TestFeedScheduleNextCheckDefault(t *testing.T) {
}
}
func TestFeedScheduleNextCheckRoundRobinMinInterval(t *testing.T) {
minInterval := 1
os.Clearenv()
os.Setenv("POLLING_SCHEDULER", "round_robin")
os.Setenv("SCHEDULER_ROUND_ROBIN_MIN_INTERVAL", fmt.Sprintf("%d", minInterval))
var err error
parser := config.NewParser()
config.Opts, err = parser.ParseEnvironmentVariables()
if err != nil {
t.Fatalf(`Parsing failure: %v`, err)
}
feed := &Feed{}
weeklyCount := 100
feed.ScheduleNextCheck(weeklyCount)
if feed.NextCheckAt.IsZero() {
t.Error(`The next_check_at must be set`)
}
if feed.NextCheckAt.After(time.Now().Add(time.Minute * time.Duration(minInterval))) {
t.Error(`The next_check_at should not be after the now + min interval`)
}
}
func TestFeedScheduleNextCheckEntryCountBasedMaxInterval(t *testing.T) {
maxInterval := 5
minInterval := 1