fix: Replace batch requests with regular ones for Token Transfers#854
Conversation
|
@C0mberry is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryReplaced batched transaction fetching ( Key changes:
Trade-offs:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: 4c391bf |
app/providers/accounts/history.tsx
Outdated
| // Fetch transactions individually to avoid batch request limitations | ||
| for (let i = 0; i < transactionSignatures.length; i++) { | ||
| const signature = transactionSignatures[i]; | ||
|
|
||
| if (i > 0) { | ||
| await new Promise(resolve => setTimeout(resolve, TRANSACTION_FETCH_DELAY_MS)); | ||
| } | ||
|
|
||
| try { | ||
| const transaction = await connection.getParsedTransaction(signature, { | ||
| maxSupportedTransactionVersion: 0, | ||
| }); | ||
| if (transaction !== null) { | ||
| transactionMap.set(signature, transaction); | ||
| } | ||
| }); | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch transaction ${signature}:`, error); | ||
| } | ||
| } |
There was a problem hiding this comment.
fetching 25 transactions sequentially with 100ms delays takes ~2.5 seconds vs ~200ms for the previous batched approach (3 batches of 10). consider implementing exponential backoff or making the delay configurable
There was a problem hiding this comment.
i wanted to avoid batch requests because we have limitations from rps
app/providers/accounts/history.tsx
Outdated
| import React from 'react'; | ||
|
|
||
| const MAX_TRANSACTION_BATCH_SIZE = 10; | ||
| const TRANSACTION_FETCH_DELAY_MS = 100; // Delay between individual transaction fetches to avoid rate limiting |
There was a problem hiding this comment.
issue: I'm still getting 429 errors on both localhost and Vercel. It doesn’t work at all on localhost 😔 Please test it more. We need to figure out what’s going on and why. Maybe we should enhance the UX so users know there are some errors, instead of leaving them with a broken/empty page.
There was a problem hiding this comment.
issue: I'm still getting 429 errors on both localhost and Vercel. It doesn’t work at all on localhost 😔 Please test it more. We need to figure out what’s going on and why. Maybe we should enhance the UX so users know there are some errors, instead of leaving them with a broken/empty page.
| Header | Header | Header | Header | Header |
|---|---|---|---|---|
| Cell | Cell | Cell | Cell | Cell |
| Cell | Cell | Cell | Cell | Cell |
| Cell | Cell | Cell | Cell | Cell |
| Cell | Cell | Cell | Cell | Cell |
|
I'd suggest rewriting the implementation. The current The next step would be to use Triton's RPCs with x-ratelimit headers, but we do not use a custom fetcher. That is a critical change. |
We could improve that inside a separate PR btw |
|
Implementation is improved. |
…heavy with requests
Description
Type of change
Screenshots
Testing
Related Issues
https://hoodies-hq.slack.com/archives/C094FS7GGBZ/p1771606003845339
Checklist
Additional Notes
IF POSSIBLE: