Skip to content

Commit

Permalink
use @functools.cache for BITTENSOR_WALLET
Browse files Browse the repository at this point in the history
  • Loading branch information
mpnowacki-reef committed Dec 7, 2024
1 parent 7bfd40c commit 9f821a4
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/src/project/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Django settings for project project.
"""

import functools
import inspect
import logging
import pathlib
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 9f821a4

Please sign in to comment.