Skip to content

Commit 0a4f8e9

Browse files
committed
WIP
1 parent b91299b commit 0a4f8e9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

async_substrate_interface/utils/cache.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
if USE_CACHE
2121
else ":memory:"
2222
)
23+
SUBSTRATE_CACHE_METHOD_SIZE = int(os.getenv("SUBSTRATE_CACHE_METHOD_SIZE", "512"))
2324

2425
logger = logging.getLogger("async_substrate_interface")
2526

@@ -66,7 +67,7 @@ async def __call__(self, chain, other_self, func, args, kwargs) -> Optional[Any]
6667
WHERE rowid IN (
6768
SELECT rowid FROM {table_name}
6869
ORDER BY created_at DESC
69-
LIMIT -1 OFFSET 500
70+
LIMIT -1 OFFSET {SUBSTRATE_CACHE_METHOD_SIZE}
7071
);
7172
END;
7273
"""
@@ -205,7 +206,7 @@ def inner(self, *args, **kwargs):
205206

206207
def async_sql_lru_cache(maxsize: Optional[int] = None):
207208
def decorator(func):
208-
@cached_fetcher(max_size=maxsize)
209+
@cached_fetcher(max_size=maxsize, cache_key_index=None)
209210
async def inner(self, *args, **kwargs):
210211
async_sql_db = AsyncSqliteDB(self.url)
211212
result = await async_sql_db(self.url, self, func, args, kwargs)

0 commit comments

Comments
 (0)