Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,16 @@ func NewIndexer(cfg config.Config) *CoreIndexer {
}
}

// Start runs the ETL indexer alongside the aggregates calculator. Both are
// long-lived; errgroup propagates the first error (and the ctx cancellation
// it triggers) to all members.
//
// Caveat: etl.Indexer.Run() uses its own internal context.Background() rather
// than honoring `ctx` — graceful shutdown via ctx cancellation isn't supported
// by the upstream API today. Process termination (SIGTERM) still works the
// way Go programs always do, and DB connections drain via pool finalizers on
// process exit. Acceptable tradeoff to avoid forking ETL.
func (ci *CoreIndexer) Start(ctx context.Context) error {
eg := errgroup.Group{}
eg, gCtx := errgroup.WithContext(ctx)
eg.Go(func() error {
return ci.aggregatesCalculator.Start(ctx)
return ci.aggregatesCalculator.Start(gCtx)
})
eg.Go(func() error {
ci.logger.Info("Starting ETL indexer")
return ci.etlIndexer.Run()
})
ci.startParityJobs(ctx)
ci.startParityJobs(gCtx)
return eg.Wait()
}

Expand Down
Loading