#2261·rq

Will RQ support redis.asyncio.Redis?

Author: itsdkeyCreated Jun 5, 2025Updated Jul 22, 2026

Currently, I'm implementing a FastAPI app where I would like to add Redis and RQ for task management.

To keep things in the "async" matter, I decided to use Redis from the redis.asyncio module, which supports async calls. However, when I tried to use RQ for my queues, as the connection, there is an error that I cannot work around because redis.info returns a coroutine.

Setup: Redis==5.2.1 RQ=2.3.3

and a small snippet:

from redis.asyncio import Redis
def create_redis(url):
    async with Redis.from_url(url, max_connections=5, decode_responses=True) as client:
        await client.ping()
        yield client

def task_something(redis):
     q = Queue(connection=redis)
     q.enqueue(f'application.foo.long_task')

task_something(await create_redis(<redis_url>))

Error:

/usr/local/lib/python3.12/site-packages/rq/queue.py:1016: in enqueue
    return self.enqueue_call(
/usr/local/lib/python3.12/site-packages/rq/queue.py:748: in enqueue_call
    return self.enqueue_job(job, pipeline=pipeline, at_front=at_front)
/usr/local/lib/python3.12/site-packages/rq/queue.py:1147: in enqueue_job
    return self._enqueue_job(job, pipeline=pipeline, at_front=at_front)
/usr/local/lib/python3.12/site-packages/rq/queue.py:1165: in _enqueue_job
    job.redis_server_version = self.get_redis_server_version()
/usr/local/lib/python3.12/site-packages/rq/queue.py:226: in get_redis_server_version
    self.redis_server_version = get_version(self.connection)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

connection = <fakeredis.aioredis.FakeRedis(<redis.asyncio.connection.ConnectionPool(<fakeredis.aioredis.FakeConnection(server=<fakeredis._server.FakeServer object at 0x75df9eed95e0>,db=0)>)>)>

    def get_version(connection: 'Redis') -> Tuple[int, int, int]:
        """
        Returns tuple of Redis server version.
        This function also correctly handles 4 digit redis server versions.
    
        Args:
            connection (Redis): The Redis connection.
    
        Returns:
            version (Tuple[int, int, int]): A tuple representing the semantic versioning format (eg. (5, 0, 9))
        """
        try:
            # Getting the connection info for each job tanks performance, we can cache it on the connection object
            if not getattr(connection, '__rq_redis_server_version', None):
                # Cast the version string to a tuple of integers. Some Redis implementations may return a float.
>               version_str = str(connection.info('server')['redis_version'])
E               TypeError: 'coroutine' object is not subscriptable

So I'm just wondering if anyone has tried to use AsyncRedis with RQ, and if it is possible, or do I need to choose between the 2 options:

  1. Switch back to sync Redis
  2. Search for an RQ substitute

Thanks