Skip to content

Commit ee6fa3a

Browse files
committed
Refactor cache handling in user metrics:
- Changed the method of copying the cache in `get_user_leverages_for_price_shock` from `deepcopy` to `copy`, to resolve error with recent python package changes. - This change enhances efficiency in memory usage while maintaining the integrity of the cache data during price shock calculations.
1 parent 579655f commit ee6fa3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/utils/user_metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ def get_user_leverages_for_price_shock(
308308
new_oracles_dat_down.append({})
309309

310310
distorted_oracles = []
311-
cache_up = copy.deepcopy(drift_client.account_subscriber.cache)
312-
cache_down = copy.deepcopy(drift_client.account_subscriber.cache)
311+
cache_up = copy.copy(drift_client.account_subscriber.cache)
312+
cache_down = copy.copy(drift_client.account_subscriber.cache)
313313

314314
for key, val in drift_client.account_subscriber.cache["oracle_price_data"].items():
315315
for i in range(scenarios):

0 commit comments

Comments
 (0)