Skip to content

Commit a30a8ab

Browse files
committed
Use asyncstdlib for lru_cache of AsyncSubstrateInterface.supports_rpc_method
1 parent 371dd1e commit a30a8ab

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

bittensor/utils/async_substrate_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import random
1111
from collections import defaultdict
1212
from dataclasses import dataclass
13-
from functools import lru_cache
1413
from hashlib import blake2b
1514
from typing import Optional, Any, Union, Callable, Awaitable, cast, TYPE_CHECKING
1615

16+
import asyncstdlib as a
1717
from async_property import async_property
1818
from bittensor_wallet import Keypair
1919
from bt_decode import PortableRegistry, decode as decode_by_type_string, MetadataV15
@@ -1705,7 +1705,7 @@ def make_payload(id_: str, method: str, params: list) -> dict:
17051705
"payload": {"jsonrpc": "2.0", "method": method, "params": params},
17061706
}
17071707

1708-
@lru_cache(maxsize=512) # RPC methods are unlikely to change often
1708+
@a.lru_cache(maxsize=512) # RPC methods are unlikely to change often
17091709
async def supports_rpc_method(self, name: str) -> bool:
17101710
"""
17111711
Check if substrate RPC supports given method

requirements/prod.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
wheel
22
setuptools~=70.0.0
33
aiohttp~=3.9
4+
asyncstdlib~=3.13.0
45
async-property==0.2.2
56
bittensor-cli
67
bt-decode==0.4.0

0 commit comments

Comments
 (0)