Skip to content

Commit

Permalink
Update _cache.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Dec 19, 2024
1 parent 08e3869 commit 25ab970
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions eth_portfolio/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,14 @@ def get_cache_file_path(args, kwargs):
if inspect.iscoroutinefunction(fn):

queue = Queue()
loaded = 0

@log_broken
async def cache_deco_worker_coro(func) -> NoReturn:
nonlocal loaded
while True:
fut, cache_path, args, kwargs = await queue.get()
try:
async with _aio_open(cache_path, "rb", executor=EXECUTOR) as f:
fut.set_result(loads(await f.read()))
loaded += 1
# unpickling traces can block up the event loop when we load them from disk
# lets not do that
if loaded % 50 == 0:
await sleep(0)
except Exception as e:
fut.set_exception(e)

Expand Down

0 comments on commit 25ab970

Please sign in to comment.