Skip to content

Commit

Permalink
fix(rfq-relayer): skip cache when fetching committable balances [SLT-…
Browse files Browse the repository at this point in the history
…386] (#3328)

* Fix: skip db cache wherever fetching committable balances
  • Loading branch information
dwasse authored Oct 29, 2024
1 parent 2adc86b commit 126e683
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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 @@ -455,7 +455,7 @@ func (i *inventoryManagerImpl) HasSufficientGas(parentCtx context.Context, chain
span.SetAttributes(attribute.String("gas_value", gasValue.String()))
}

gasBalance, err := i.GetCommittableBalance(ctx, chainID, util.EthAddress)
gasBalance, err := i.GetCommittableBalance(ctx, chainID, util.EthAddress, SkipDBCache())
if err != nil {
return false, fmt.Errorf("error getting committable gas on origin: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions services/rfq/relayer/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (q *QuoteRequestHandler) commitPendingBalance(ctx context.Context, span tra
defer unlocker.Unlock()

// get destination committable balance
committableBalance, err := q.Inventory.GetCommittableBalance(ctx, int(q.Dest.ChainID), request.Transaction.DestToken)
committableBalance, err := q.Inventory.GetCommittableBalance(ctx, int(q.Dest.ChainID), request.Transaction.DestToken, inventory.SkipDBCache())
if errors.Is(err, inventory.ErrUnsupportedChain) {
// don't process request if chain is currently unsupported
span.AddEvent("dropping unsupported chain")
Expand Down Expand Up @@ -626,7 +626,7 @@ func (q *QuoteRequestHandler) handleNotEnoughInventory(ctx context.Context, span
defer unlocker.Unlock()

// commit destination balance
committableBalance, err := q.Inventory.GetCommittableBalance(ctx, int(q.Dest.ChainID), request.Transaction.DestToken)
committableBalance, err := q.Inventory.GetCommittableBalance(ctx, int(q.Dest.ChainID), request.Transaction.DestToken, inventory.SkipDBCache())
if err != nil {
return fmt.Errorf("could not get committable balance: %w", err)
}
Expand Down

0 comments on commit 126e683

Please sign in to comment.