Maybe spawn `brokerd` in `asyncio` mode if declared in backend mod

broker_bumpz
Tyler Goodlet 2022-03-17 09:03:44 -04:00
parent b26b66cc66
commit 937406534c
1 changed files with 12 additions and 4 deletions

View File

@ -142,15 +142,23 @@ async def symbol_search(
brokermods: list[ModuleType], brokermods: list[ModuleType],
pattern: str, pattern: str,
**kwargs, **kwargs,
) -> Dict[str, Dict[str, Dict[str, Any]]]: ) -> Dict[str, Dict[str, Dict[str, Any]]]:
"""Return symbol info from broker. '''
""" Return symbol info from broker.
'''
results = [] results = []
async def search_backend(brokername: str) -> None: async def search_backend(
brokermod: ModuleType
) -> None:
brokername: str = mod.name
async with maybe_spawn_brokerd( async with maybe_spawn_brokerd(
brokername, mod.name,
infect_asyncio=getattr(mod, '_infect_asyncio', False),
) as portal: ) as portal:
results.append(( results.append((