From f3dd0d4d992d02c3ed16c02ad6094a256e110608 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Fri, 7 Nov 2025 11:22:25 -0400 Subject: [PATCH] feat: get loop from Future instead of context-local storage This should be faster on the benchmarks, not sure though. --- async_lru/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/async_lru/__init__.py b/async_lru/__init__.py index 447e9cdb..e6a71704 100644 --- a/async_lru/__init__.py +++ b/async_lru/__init__.py @@ -185,7 +185,7 @@ def _task_done_callback( cache_item = self.__cache.get(key) if self.__ttl is not None and cache_item is not None: - loop = asyncio.get_running_loop() + loop = fut.get_loop() cache_item.later_call = loop.call_later( self.__ttl, self.__cache.pop, key, None )