Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions taskiq/task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
from logging import getLogger
from time import time
from typing import TYPE_CHECKING, Any, Generic, Optional

Expand All @@ -9,6 +10,7 @@
ResultIsReadyError,
TaskiqResultTimeoutError,
)
from taskiq.result_backends.dummy import DummyResultBackend

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


logger = getLogger("taskiq")


class AsyncTaskiqTask(Generic[_ReturnType]):
"""AsyncTask for AsyncResultBackend."""

Expand Down Expand Up @@ -83,6 +88,9 @@ async def wait_result(
become ready in provided period of time.
:return: task's return value.
"""
if isinstance(self.result_backend, DummyResultBackend):
logger.warning("No result backend configured. Returning dummy result...")

start_time = time()
while not await self.is_ready():
await asyncio.sleep(check_interval)
Expand Down