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:
parent
fe0ef8b579
commit
70b69ecd19
6 changed files with 76 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue