From ebbfa7f48d2098832ef38b4bebaef3138b7928a1 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 12 Jun 2023 21:58:19 -0400 Subject: [PATCH] Passthrough kwargs to `open_cached_client()` --- piker/_cacheables.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/piker/_cacheables.py b/piker/_cacheables.py index 9be4d079..279f3188 100644 --- a/piker/_cacheables.py +++ b/piker/_cacheables.py @@ -110,6 +110,8 @@ def async_lifo_cache( @acm async def open_cached_client( brokername: str, + **kwargs, + ) -> 'Client': # noqa ''' Get a cached broker client from the current actor's local vars. @@ -120,5 +122,11 @@ async def open_cached_client( brokermod = get_brokermod(brokername) async with maybe_open_context( acm_func=brokermod.get_client, + kwargs=kwargs, + ) as (cache_hit, client): + + if cache_hit: + log.info(f'Reusing existing {client}') + yield client