File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,12 +165,14 @@ async def _task_handler(
165165 """
166166 # Poll for completion
167167 task: GetTaskResult
168+ poll_interval = DEFAULT_POLLING_INTERVAL * 1000.0
168169 while True:
169170 try:
170171 task = await self.session.get_task(task_id)
171172 except McpError as e:
172173 if e.error.code == INVALID_PARAMS:
173174 # Task may not exist yet
175+ await anyio.sleep(poll_interval / 1000.0)
174176 continue
175177 raise
176178 await on_task_status(task)
@@ -179,8 +181,8 @@ async def _task_handler(
179181 break
180182
181183 # Wait before polling again
182- poll_frequency = task.pollInterval if task.pollInterval is not None else DEFAULT_POLLING_INTERVAL * 1000
183- await anyio.sleep(poll_frequency / 1000.0)
184+ poll_interval = task.pollInterval if task.pollInterval is not None else DEFAULT_POLLING_INTERVAL * 1000
185+ await anyio.sleep(poll_interval / 1000.0)
184186
185187 # Retrieve and return the result
186188 return await self.session.get_task_result(task_id, self.result_type)
You can’t perform that action at this time.
0 commit comments