diff --git a/commit/plugin.go b/commit/plugin.go index 873592d8f..c63f6f350 100644 --- a/commit/plugin.go +++ b/commit/plugin.go @@ -3,7 +3,6 @@ package commit import ( "context" "fmt" - "sync" "time" "github.com/smartcontractkit/libocr/commontypes" @@ -197,51 +196,34 @@ func (p *Plugin) Outcome( ) } - wg := &sync.WaitGroup{} - wg.Add(3) - - var merkleOutcome merkleroot.Outcome - var tokensOutcome tokenprice.Outcome - var gasOutcome chainfee.Outcome - - go func(mOut *merkleroot.Outcome) { - defer wg.Done() - outcome, err := p.merkleProcessor.Outcome( - prevOutcome.MerkleRootOutcome, - merkleroot.Query{}, - merkleObservations, - ) - if err != nil { - p.lggr.Errorw("failed to get merkle outcome", "err", err) - } - - *mOut = outcome - }(&merkleOutcome) + merkleRootOutcome, err := p.merkleProcessor.Outcome( + prevOutcome.MerkleRootOutcome, + merkleroot.Query{}, + merkleObservations, + ) + if err != nil { + p.lggr.Errorw("failed to get merkle outcome", "err", err) + } - go func(tOut *tokenprice.Outcome) { - defer wg.Done() - outcome, err := p.tokenProcessor.Outcome(prevOutcome.TokenPriceOutcome, tokenprice.Query{}, tokensObservations) - if err != nil { - p.lggr.Errorw("failed to get token prices outcome", "err", err) - } - *tOut = outcome - }(&tokensOutcome) + tokenPriceOutcome, err := p.tokenProcessor.Outcome( + prevOutcome.TokenPriceOutcome, + tokenprice.Query{}, + tokensObservations, + ) - go func(gOut *chainfee.Outcome) { - defer wg.Done() - outcome, err := p.feeProcessor.Outcome(prevOutcome.ChainFeeOutcome, chainfee.Query{}, feeObservations) - if err != nil { - p.lggr.Errorw("failed to get gas prices outcome", "err", err) - } - *gOut = outcome - }(&gasOutcome) + if err != nil { + p.lggr.Errorw("failed to get token prices outcome", "err", err) + } - wg.Wait() + chainFeeOutcome, err := p.feeProcessor.Outcome(prevOutcome.ChainFeeOutcome, chainfee.Query{}, feeObservations) + if err != nil { + p.lggr.Errorw("failed to get gas prices outcome", "err", err) + } return Outcome{ - MerkleRootOutcome: merkleOutcome, - TokenPriceOutcome: tokensOutcome, - ChainFeeOutcome: gasOutcome, + MerkleRootOutcome: merkleRootOutcome, + TokenPriceOutcome: tokenPriceOutcome, + ChainFeeOutcome: chainFeeOutcome, }.Encode() }