diff --git a/backfill/backfill.go b/backfill/backfill.go index 85377cb8..66543201 100644 --- a/backfill/backfill.go +++ b/backfill/backfill.go @@ -196,11 +196,11 @@ func NewBackfiller( } } -// Start starts the backfill processor routine -func (b *Backfiller) Start() { +// StartWithLogger starts the backfill processor routine with a custom logger +func (b *Backfiller) StartWithLogger(log *slog.Logger) { ctx := context.Background() - log := slog.With("source", "backfiller", "name", b.Name) + log = log.With("source", "backfiller", "name", b.Name) log.Info("starting backfill processor") sem := semaphore.NewWeighted(int64(b.ParallelBackfills)) @@ -265,6 +265,11 @@ func (b *Backfiller) Start() { } } +// Start starts the backfill processor routine +func (b *Backfiller) Start() { + b.StartWithLogger(slog.Default()) +} + // Stop stops the backfill processor func (b *Backfiller) Stop(ctx context.Context) error { log := slog.With("source", "backfiller", "name", b.Name) @@ -351,7 +356,7 @@ type FetchRepoError struct { } func (e *FetchRepoError) Error() string { - reason := "unknown error" + var reason string if e.StatusCode == http.StatusBadRequest { reason = "repo not found" } else { diff --git a/backfill/gormstore.go b/backfill/gormstore.go index 514e5756..e3c394a4 100644 --- a/backfill/gormstore.go +++ b/backfill/gormstore.go @@ -71,7 +71,7 @@ func (s *Gormstore) loadJobs(ctx context.Context, limit int) error { retryableIndexClause := "" // If the DB is a SQLite DB, we can use INDEXED BY to speed up the query - if s.db.Dialector.Name() == "sqlite" { + if s.db.Name() == "sqlite" { enqueuedIndexClause = "INDEXED BY enqueued_job_idx" retryableIndexClause = "INDEXED BY retryable_job_idx" }