taskiq-redis icon indicating copy to clipboard operation
taskiq-redis copied to clipboard

TaskiqDeprecationWarning: use `with_result_backend`

Open tito opened this issue 1 year ago • 5 comments

Using taskiq 0.11.7 and taskiq-redis 1.0.2, i have this deprecation warning showing up:

/.venv/lib/python3.10/site-packages/taskiq_redis/redis_broker.py:49: TaskiqDeprecationWarning: Setting result backend with constructor is deprecated. Please use `with_result_backend` instead.

The code that triggered it:

from taskiq_redis import ListQueueBroker, RedisAsyncResultBackend

from app.core.config import settings

redis_async_result = RedisAsyncResultBackend(redis_url=settings.REDIS_URL)

broker = ListQueueBroker(
    url=settings.REDIS_URL,
    result_backend=redis_async_result,
)

tito avatar Oct 09 '24 21:10 tito

I guess the github docs for this repo hasn't been updated yet. There is a with_result_backend method on ListQueueBroker as well.

from this doc: https://taskiq-python.github.io/guide/getting-started.html#distributed-run

from taskiq_aio_pika import AioPikaBroker
from taskiq_redis import RedisAsyncResultBackend

broker = AioPikaBroker(
    "amqp://guest:guest@localhost:5672",
).with_result_backend(RedisAsyncResultBackend("redis://localhost"))

@tito

ItsCurstin avatar Oct 09 '24 22:10 ItsCurstin

@CurstinJR, yes, you are correct. Will update soon.

s3rius avatar Oct 10 '24 10:10 s3rius

Works, thank you !

tito avatar Oct 10 '24 20:10 tito

@s3rius hello, can you please clarify if it is necessary to call broker.startup() with ListQueueBroker in taskiq_redis?

remixer-dec avatar Oct 11 '24 05:10 remixer-dec

It's kinda not, but I highly advise you doing so.

s3rius avatar Oct 11 '24 09:10 s3rius