From a646e33792660795e2b6f17847130f94ef84ff3e Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 19 Jul 2024 19:44:11 +0300 Subject: [PATCH] fix: `if` instead of `while` --- taskiq/receiver/receiver.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taskiq/receiver/receiver.py b/taskiq/receiver/receiver.py index 853ed24..c9d5c24 100644 --- a/taskiq/receiver/receiver.py +++ b/taskiq/receiver/receiver.py @@ -269,11 +269,13 @@ async def run_task( # noqa: C901, PLR0912, PLR0915 logger.warning("Timeouts for sync tasks don't work in python well.") with anyio.fail_after(float(timeout)): - while inspect.isawaitable(target_future): + target_future = await target_future + if inspect.isawaitable(target_future): target_future = await target_future else: - while inspect.isawaitable(target_future): + target_future = await target_future + if inspect.isawaitable(target_future): target_future = await target_future returned = target_future