From 52cdc6013f9fbc8e009f5c425a943795c916350f Mon Sep 17 00:00:00 2001 From: Mateusz Sekara Date: Wed, 24 Jul 2024 16:23:57 +0200 Subject: [PATCH] Don't propagate parent's context for the background replay (#1219) ## Solution It adds the missing part to this PR https://github.com/smartcontractkit/ccip/pull/1201 We can't pass the foreground routine context to the task run in the background and could take minutes or hours to finish. Instead of that, we create a background context and expose cancelFn. This is exactly how it used to work before introducing loopp layer --- .../plugins/ccip/internal/oraclelib/backfilled_oracle.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/internal/oraclelib/backfilled_oracle.go b/core/services/ocr2/plugins/ccip/internal/oraclelib/backfilled_oracle.go index 3c5ab64103..d2851e3a07 100644 --- a/core/services/ocr2/plugins/ccip/internal/oraclelib/backfilled_oracle.go +++ b/core/services/ocr2/plugins/ccip/internal/oraclelib/backfilled_oracle.go @@ -140,13 +140,13 @@ type ChainAgnosticBackFilledOracle struct { cancelFn context.CancelFunc } -func (r *ChainAgnosticBackFilledOracle) Start(ctx context.Context) error { - go r.run(ctx) +func (r *ChainAgnosticBackFilledOracle) Start(_ context.Context) error { + go r.run() return nil } -func (r *ChainAgnosticBackFilledOracle) run(ctx context.Context) { - ctx, cancelFn := context.WithCancel(ctx) +func (r *ChainAgnosticBackFilledOracle) run() { + ctx, cancelFn := context.WithCancel(context.Background()) r.cancelFn = cancelFn var err error var errMu sync.Mutex