Open CyrusVorwald opened 2 weeks ago
Caching can be done in a couple places but this is probably not one of them - better to cache things before even hitting this algo I think which is fast compared to data fetching operations.
But yes, there is a place to do caching particularly in the pool_series cron which I know is doing some extra work right now and is one of the slowest crons we have.
Generally though these issues about caching / improving performance will have less impact on scalability compared to just simply going async which is a known issue.
balanced_backend/utils/prices.py
builds the graph for token price calculations from scratch on every invocation of theget_token_prices
function. Paths should be cached and only recalculated when topology changes