From 9f821a48ffff986ae7fb0640aef0c22bcfa45345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Nowacki?= Date: Sat, 7 Dec 2024 14:09:27 +0100 Subject: [PATCH] use @functools.cache for BITTENSOR_WALLET --- app/src/project/settings.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/project/settings.py b/app/src/project/settings.py index 3a456f0..124c2f2 100644 --- a/app/src/project/settings.py +++ b/app/src/project/settings.py @@ -1,7 +1,7 @@ """ Django settings for project project. """ - +import functools import inspect import logging import pathlib @@ -371,14 +371,9 @@ def wrapped(*args, **kwargs): raise RuntimeError("Both BITTENSOR_WALLET_NAME and BITTENSOR_WALLET_HOTKEY_NAME must be set when " "CENTRAL_PROMETHEUS_PROXY_URL is defined") -_wallet = None - +@functools.cache def BITTENSOR_WALLET() -> bittensor.wallet: - global _wallet - if _wallet: - return _wallet - if not BITTENSOR_WALLET_NAME or not BITTENSOR_WALLET_HOTKEY_NAME: raise RuntimeError("Wallet not configured") wallet = bittensor.wallet(