Skip to content

Commit da4b74d

Browse files
committed
debug: add log to calculate the time to get quotes
1 parent 88007d4 commit da4b74d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

apps/kyberswap-interface/src/pages/CrossChainSwap/hooks/useCrossChainSwap.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ export const CrossChainSwapRegistryProvider = ({ children }: { children: React.R
608608
setLoading(true)
609609
setAllLoading(true)
610610

611+
// Track quote fetching time
612+
const quoteStartTime = performance.now()
613+
console.log('[Quote Timing] Starting to fetch quotes...')
614+
611615
const getQuotesWithCancellation = async (params: QuoteParams | NearQuoteParams) => {
612616
const quotes: Quote[] = []
613617

@@ -926,6 +930,14 @@ export const CrossChainSwapRegistryProvider = ({ children }: { children: React.R
926930
} finally {
927931
setLoading(false)
928932
setAllLoading(false)
933+
934+
// Log total time taken to fetch all quotes
935+
const quoteEndTime = performance.now()
936+
const totalTime = quoteEndTime - quoteStartTime
937+
console.log(
938+
`[Quote Timing] All quotes fetched and processed. Total time: ${totalTime.toFixed(2)}ms (${(totalTime / 1000).toFixed(2)}s)`,
939+
)
940+
console.log(`[Quote Timing] Number of quotes received: ${quotes.length}`)
929941
}
930942
}, [
931943
sender,

0 commit comments

Comments
 (0)