From 3b2006593001f1af41adb153d05a2f2dcc972aac Mon Sep 17 00:00:00 2001 From: ans-artal <92530185+ans-artal@users.noreply.github.com> Date: Tue, 3 Mar 2026 17:32:19 +0100 Subject: [PATCH] fix: check readiness before timeout I think that when a task completes as the timeout expire, the code should return the result rather than raise. --- taskiq/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskiq/task.py b/taskiq/task.py index b4a0f52f..550dabee 100644 --- a/taskiq/task.py +++ b/taskiq/task.py @@ -98,9 +98,9 @@ async def wait_result( """ start_time = time() while not await self.is_ready(): - await asyncio.sleep(check_interval) if 0 < timeout < time() - start_time: raise TaskiqResultTimeoutError(timeout=timeout) + await asyncio.sleep(check_interval) return await self.get_result(with_logs=with_logs) async def get_progress(self) -> "TaskProgress[Any] | None":