Skip to content

Error while fetching scheduled tasks from redis cluster #61

Closed
@tokikanno

Description

@tokikanno

while using taskiq-redis schedule source on redis cluster with more than 1 node, it will refuse to run while executing mget command in the get_schedules() function

I think it's because not all scheduled tasks are stored on the same key slot, so the mget refused to fetch.

  File "/usr/local/lib/python3.11/site-packages/taskiq/cli/scheduler/run.py", line 45, in get_schedules
    return await source.get_schedules()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taskiq_redis/schedule_source.py", line 166, in get_schedules
    schedules.extend(await self.redis.mget(buffer))  # type: ignore[attr-defined]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

# truncated ....

  File "/usr/local/lib/python3.11/site-packages/redis/asyncio/cluster.py", line 593, in _determine_nodes
    await self._determine_slot(command, *args),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/redis/asyncio/cluster.py", line 643, in _determine_slot
    raise RedisClusterException(
redis.exceptions.RedisClusterException: MGET - all keys must map to the same key slot

Dead in this line
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions