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 eb73dbe commit 1cb6ab5
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions eth_portfolio/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ async def cache_deco_worker_coro() -> NoReturn:
@functools.wraps(fn)
async def disk_cache_wrap(*args: P.args, **kwargs: P.kwargs) -> T:
cache_path = get_cache_file_path(args, kwargs)
fut = get_event_loop().create_future()
queue.put_nowait((fut, cache_path, args, kwargs))
if workers is None:
workers = tuple(create_task(cache_deco_worker_coro()) for _ in range(1000))
try:
fut = get_event_loop().create_future()
queue.put_nowait((fut, cache_path, args, kwargs))
if workers is None:
workers = tuple(create_task(cache_deco_worker_coro()) for _ in range(1000))
try:
return await fut
except EOFError:
pass
except FileNotFoundError:
return await fut
except (FileNotFoundError, EOFError):
pass

async_result: T = await fn(*args, **kwargs)
Expand Down

0 comments on commit 1cb6ab5

Please sign in to comment.