balancednetwork / balanced-backend

Backend to balanced stats page and other services
Apache License 2.0
0 stars 1 forks source link

Cache price graph #72

Open CyrusVorwald opened 2 weeks ago

CyrusVorwald commented 2 weeks ago

balanced_backend/utils/prices.py builds the graph for token price calculations from scratch on every invocation of the get_token_prices function. Paths should be cached and only recalculated when topology changes

robcxyz commented 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.