Passthrough kwargs to `open_cached_client()`

basic_buy_bot
Tyler Goodlet 2023-06-12 21:58:19 -04:00
parent bb02775cab
commit ebbfa7f48d
1 changed files with 8 additions and 0 deletions

View File

@ -110,6 +110,8 @@ def async_lifo_cache(
@acm @acm
async def open_cached_client( async def open_cached_client(
brokername: str, brokername: str,
**kwargs,
) -> 'Client': # noqa ) -> 'Client': # noqa
''' '''
Get a cached broker client from the current actor's local vars. 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) brokermod = get_brokermod(brokername)
async with maybe_open_context( async with maybe_open_context(
acm_func=brokermod.get_client, acm_func=brokermod.get_client,
kwargs=kwargs,
) as (cache_hit, client): ) as (cache_hit, client):
if cache_hit:
log.info(f'Reusing existing {client}')
yield client yield client