-
Notifications
You must be signed in to change notification settings - Fork 5
Description
When using redis-entraid as the message broker for Dramatiq, redis-entraid calls get_credentials by default. There's no explicit way to configure the redis-entraid class to call get_credentials_async for authentication. This serves as a blocking operation when calling dramatiq's actor.send() method in an async FastAPI context and freezes up the main event loop of the server.
`async def _async_send(actor, *args, **kwargs):
"""Running actor.send in a default ThreadPoolExecutor so that synchronous Redis I/O does not block."""
loop = asyncio.get_running_loop()
return await loop.run_in_executor(None, partial(actor.send, *args, **kwargs))
`
This code block is a simple work around but there should be a way to initialise the class in an async context so it uses get_credentials_async on default to authenticate the redis client with either of Azure's modes of authentication