Skip to content

Commit

Permalink
Don't propagate parent's context for the background replay (#1219)
Browse files Browse the repository at this point in the history
## Solution

It adds the missing part to this PR
#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
  • Loading branch information
mateusz-sekara authored Jul 24, 2024
1 parent 5ef031c commit 52cdc60
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52cdc60

Please sign in to comment.