Skip to content

Commit

Permalink
Fix: misc context leaks (#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasse authored Aug 7, 2024
1 parent f042b8e commit bf40e0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion services/rfq/relayer/inventory/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func NewInventoryManager(ctx context.Context, clientFetcher submitter.ClientFetc

//nolint:gocognit,cyclop
func (i *inventoryManagerImpl) Start(ctx context.Context) error {
g, _ := errgroup.WithContext(ctx)
g, ctx := errgroup.WithContext(ctx)
for _, rebalanceManager := range i.rebalanceManagers {
rebalanceManager := rebalanceManager
g.Go(func() error {
Expand Down
19 changes: 8 additions & 11 deletions services/rfq/relayer/pricer/fee_pricer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/synapsecns/sanguine/services/rfq/relayer/relconfig"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"golang.org/x/sync/errgroup"
)

// FeePricer is the interface for the fee pricer.
Expand Down Expand Up @@ -66,17 +65,15 @@ func NewFeePricer(config relconfig.Config, clientFetcher submitter.ClientFetcher
}

func (f *feePricer) Start(ctx context.Context) {
g, _ := errgroup.WithContext(ctx)

// Start the TTL caches.
g.Go(func() error {
f.gasPriceCache.Start()
return nil
})
g.Go(func() error {
f.tokenPriceCache.Start()
return nil
})
go f.gasPriceCache.Start()
go f.tokenPriceCache.Start()

go func() {
<-ctx.Done()
f.gasPriceCache.Stop()
f.tokenPriceCache.Stop()
}()
}

var nativeDecimalsFactor = new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(18)), nil)
Expand Down

0 comments on commit bf40e0a

Please sign in to comment.