fix: importer timeout ignored in scheduler
Alan Pearce alan@alanpearce.eu
Thu, 27 Mar 2025 15:29:36 +0100
1 files changed, 5 insertions(+), 2 deletions(-)
jump to
M internal/importer/main.go → internal/importer/main.go
@@ -286,7 +286,7 @@ return nil } func (imp *Importer) StartUpdateTimer( - ctx context.Context, + parentCtx context.Context, localHub *sentry.Hub, ) { const monitorSlug = "import" @@ -311,7 +311,7 @@ SetNextRun(nextRun) for { imp.log.Debug("scheduling next run", "next-run", nextRun) select { - case <-ctx.Done(): + case <-parentCtx.Done(): imp.log.Debug("stopping scheduler") return @@ -325,7 +325,10 @@ Status: sentry.CheckInStatusInProgress, }, monitorConfig) MarkIndexingStarted() + ctx, cancel := context.WithTimeout(parentCtx, imp.config.Importer.Timeout.Duration) err = imp.Start(ctx, false, nil) + cancel() + if err != nil { imp.log.Warn("error updating index", "error", err)