Skip to content

Commit

Permalink
using multierr
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Jul 3, 2024
1 parent 39a7de7 commit a4474ab
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions core/services/ocr2/plugins/ccip/proxycommitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"math/big"
"time"

"go.uber.org/multierr"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas"

cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip"
Expand Down Expand Up @@ -129,18 +131,5 @@ func (p *ProviderProxyCommitStoreReader) SetSourceMaxGasPrice(ctx context.Contex
}

func (p *ProviderProxyCommitStoreReader) Close() error {
ok := true
err := p.srcCommitStoreReader.Close()
if err != nil {
ok = false
}
err2 := p.dstCommitStoreReader.Close()
if err2 != nil {
ok = false
}

if !ok {
return fmt.Errorf("failed to close commit store reader: %w or %w", err, err2)
}
return nil
return multierr.Append(p.srcCommitStoreReader.Close(), p.dstCommitStoreReader.Close())
}

0 comments on commit a4474ab

Please sign in to comment.