-
Notifications
You must be signed in to change notification settings - Fork 60
feat: reduce RPC usage in API #1693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks for looking into this. Left one question
api/_utils.ts
Outdated
@@ -1300,7 +1302,8 @@ function getProviderFromConfigJson( | |||
3, // max. concurrency used in `SpeedProvider` | |||
5, // max. concurrency used in `RateLimitedProvider` | |||
"RPC_PROVIDER", // cache namespace | |||
1 // disable RPC calls logging | |||
0, // disable RPC calls logging | |||
redisCache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you verify that something gets written to Upstash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, doesn't look like it is from the preview. Will take a pass tonight to figure out why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, the issue was fixed. We needed a distance from HEAD.
Fixing this revealed some issues related to differences from our regular redis client vs the upstash one. For some reason, I'm seeing it strip quote characters (which breaks the provider caching). I was able to put in a workaround, but PTAL and let me know if you have a better idea.
@@ -355,7 +353,10 @@ export async function extractDepositDataStruct( | |||
exclusiveRelayer: | |||
crossSwapQuotes.bridgeQuote.suggestedFees.exclusiveRelayer, | |||
quoteTimestamp: crossSwapQuotes.bridgeQuote.suggestedFees.timestamp, | |||
fillDeadline: await getFillDeadline(spokePool), | |||
fillDeadline: getFillDeadline( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 💪
Signed-off-by: Matt Rice <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
09e134a
This makes three changes to reduce RPC usage in the API: