aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/scheduler.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cli/scheduler.go')
-rw-r--r--internal/cli/scheduler.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/cli/scheduler.go b/internal/cli/scheduler.go
index 6bde37c0..9f69d7ea 100644
--- a/internal/cli/scheduler.go
+++ b/internal/cli/scheduler.go
@@ -20,6 +20,7 @@ func runScheduler(store *storage.Storage, pool *worker.Pool) {
pool,
config.Opts.PollingFrequency(),
config.Opts.BatchSize(),
+ config.Opts.PollingParsingErrorLimit(),
)
go cleanupScheduler(
@@ -28,10 +29,16 @@ func runScheduler(store *storage.Storage, pool *worker.Pool) {
)
}
-func feedScheduler(store *storage.Storage, pool *worker.Pool, frequency, batchSize int) {
+func feedScheduler(store *storage.Storage, pool *worker.Pool, frequency, batchSize, errorLimit int) {
for range time.Tick(time.Duration(frequency) * time.Minute) {
- jobs, err := store.NewBatch(batchSize)
- if err != nil {
+ // Generate a batch of feeds for any user that has feeds to refresh.
+ batchBuilder := store.NewBatchBuilder()
+ batchBuilder.WithBatchSize(batchSize)
+ batchBuilder.WithErrorLimit(errorLimit)
+ batchBuilder.WithoutDisabledFeeds()
+ batchBuilder.WithNextCheckExpired()
+
+ if jobs, err := batchBuilder.FetchJobs(); err != nil {
slog.Error("Unable to fetch jobs from database", slog.Any("error", err))
} else {
slog.Info("Created a batch of feeds",