Skip to content

Commit 9ac6bf7

Browse files
warn on .wait_result call if there is no result backend
1 parent 319ac9f commit 9ac6bf7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

taskiq/task.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
from logging import getLogger
23
from time import time
34
from typing import TYPE_CHECKING, Any, Generic, Optional
45

@@ -9,6 +10,7 @@
910
ResultIsReadyError,
1011
TaskiqResultTimeoutError,
1112
)
13+
from taskiq.result_backends.dummy import DummyResultBackend
1214

1315
if TYPE_CHECKING: # pragma: no cover
1416
from taskiq.abc.result_backend import AsyncResultBackend
@@ -18,6 +20,9 @@
1820
_ReturnType = TypeVar("_ReturnType")
1921

2022

23+
logger = getLogger("taskiq")
24+
25+
2126
class AsyncTaskiqTask(Generic[_ReturnType]):
2227
"""AsyncTask for AsyncResultBackend."""
2328

@@ -83,6 +88,9 @@ async def wait_result(
8388
become ready in provided period of time.
8489
:return: task's return value.
8590
"""
91+
if isinstance(self.result_backend, DummyResultBackend):
92+
logger.warning("No result backend configured. Returning dummy result...")
93+
8694
start_time = time()
8795
while not await self.is_ready():
8896
await asyncio.sleep(check_interval)

0 commit comments

Comments
 (0)