TaskiqDeprecationWarning: use `with_result_backend`
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,
)
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
@CurstinJR, yes, you are correct. Will update soon.
Works, thank you !
@s3rius hello, can you please clarify if it is necessary to call broker.startup() with ListQueueBroker in taskiq_redis?
It's kinda not, but I highly advise you doing so.