Skip to content

Even after adding TTL in result backend the data is growing redis. #681

Description

@johnynetralabs

Taskiq version

0.12.6

Python version

Python 3.12

OS

Linux

What happened?

result_backend = RedisAsyncResultBackend(
redis_url=settings.REDIS_URL_TASK_IQ,
result_ex_time=3600,
max_connection_pool_size=settings.TASKIQ_RESULT_BACKEND_POOL_SIZE,
)

Adding result_ex_time=3600, but after 3600 sec data still in redis and overtime data grows and eventually gets max memory issue from redis.

Is there any other setting which we can enable to prevent this issue?

Relevant log output

Broker initialization code

Activity

  1. s3rius commented on Sep 23, 2026

    @s3rius
    Member

    Can you test that keys have expiration assigned to them? If yes, it's not a bug, it's how redis handles expiration.

    https://redis.io/docs/latest/commands/expire/#how-redis-expires-keys

    Redis keys are expired in two ways: a passive way and an active way.

    A key is passively expired when a client tries to access it and the key is timed out.

    However, this is not enough as there are expired keys that will never be accessed again. These keys should be expired anyway, so periodically, Redis tests a few keys at random amongst the set of keys with an expiration. All the keys that are already expired are deleted from the keyspace.

    Please check that expire is assigned to keys using TTL command on one of keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions