Skip to content

Commit

Permalink
feat(backend): use cache when fetching outgoing payment in worker
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurapov committed Dec 2, 2024
1 parent 5de6208 commit 3848d02
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/backend/src/open_payments/payment/outgoing/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function getPendingPayment(
[RETRY_BACKOFF_SECONDS, now]
)
})
.withGraphFetched('[walletAddress, quote.asset]')
.withGraphFetched('quote')
stopTimer()
return payments[0]
}
Expand All @@ -89,6 +89,16 @@ async function handlePaymentLifecycle(
return
}

const [paymentWalletAddress, quoteAsset] = await Promise.all([
deps.walletAddressService.get(payment.walletAddressId),
deps.assetService.get(payment.quote.assetId)
])

payment.walletAddress = paymentWalletAddress
if (quoteAsset) {
payment.quote.asset = quoteAsset
}

const stopTimer = deps.telemetry.startTimer('handle_sending_ms', {
callName: 'OutoingPaymentWorker:handleSending'
})
Expand Down

0 comments on commit 3848d02

Please sign in to comment.