Skip to content

Commit

Permalink
fix: add exception handler for new tokens that have no swaps #62
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Jul 22, 2024
1 parent 2cab01f commit c85e744
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion balanced_backend/utils/prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ def get_token_prices(
# node if it has already been calculated.
for t in tokens:
# Get the shortest weighted path to the target token
path = nx.dijkstra_path(G, source=root_address, target=t.address)
try:
path = nx.dijkstra_path(G, source=root_address, target=t.address)
except nx.exception.NetworkXNoPath:
# Sometimes no swaps (ie just deployed)
# https://github.com/balancednetwork/balanced-backend/issues/62
logger.info(f"Missing data for {t.address}")
continue

# Store the path in the DB
t.path = path
Expand Down

0 comments on commit c85e744

Please sign in to comment.