-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve(API): Make gasFeeTotal more accurate in /limits and increase …
…cache hit frequency (#1369) * improve(API): Reduce stale-while-revalidate and gas price cache times ## `stale-while-revalidate` We can reduce this cache time to 1s so that after the cached value is >1s old we can immediately start recomputing the limits value. This means in the best case we'll have as fresh gas cost data as possible. ## Gas price caching: We should ideally use less stale gas price data. However, we don't want to increase the /limits response time. We currently use the gas price to compute the gas cost so it makes sense to make the gas price cache time slightly longer or equal to the gas cost. This way if the gas cost cache is set, then we'll use the cached gas cost value. If its stale, then we'll fetch the gas price and hopefully hit the cache sometimes. This is why it doesn't make sense to set the gas price cache less than the gas cost cache time otherwise we'll very rarely hit the gas price cache. * Separate native gas cost and op stack l1 gas cost calculation from tokenGasCost calculation Willl allow us to use more customized caching times for different gas cost components that are expected to change on different time periods * Use gas price cache for Linea as well * fix: only cron cache gas prices for non Linea chains * Update limits.ts * Only pass in depositArgs for Linea * add extra part to cache key * Use sdk for helper methods * Update limits.ts * Fix gas-prices * Use utils in gas-prices.ts to read data from cache * add gas costs to cron job * cache gas prices before cost * remove promise.all * Update _utils.ts * cache op stack l1 costs for op chains only * Test only cache gas prices * debug * Fix cron job * Update cron-cache-gas-prices.ts * fix promise nesting * Update cron-cache-gas-prices.ts * update cache times * Update _utils.ts * Update cron-cache-gas-prices.ts * Add native gas cost caching Keep cache warm * Increase ttl of native gas cost, add gasFeeDetails to response * sdk
- Loading branch information
1 parent
5b9b48f
commit 09d3771
Showing
6 changed files
with
426 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.