log nb_jobs only when number of jobs is larger than 0 in scheduler.

This commit is contained in:
Shizun Ge 2023-11-29 21:48:14 -08:00 committed by Frédéric Guillot
parent 1af1bc3460
commit f3f892f448

View file

@ -40,7 +40,7 @@ func feedScheduler(store *storage.Storage, pool *worker.Pool, frequency, batchSi
if jobs, err := batchBuilder.FetchJobs(); err != nil { if jobs, err := batchBuilder.FetchJobs(); err != nil {
slog.Error("Unable to fetch jobs from database", slog.Any("error", err)) slog.Error("Unable to fetch jobs from database", slog.Any("error", err))
} else { } else if len(jobs) > 0 {
slog.Info("Created a batch of feeds", slog.Info("Created a batch of feeds",
slog.Int("nb_jobs", len(jobs)), slog.Int("nb_jobs", len(jobs)),
) )