Skip to content

Commit f1a973a

Browse files
committed
use move on after rather than fail_after to simplify code for the same result
1 parent 5750c32 commit f1a973a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/mcp/shared/session.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ async def receive_response(
292292
assert request is not None
293293

294294
try:
295-
with anyio.fail_after(timeout):
295+
with anyio.move_on_after(timeout):
296296
return await receive_stream.receive()
297297
except anyio.EndOfStream:
298298
raise McpError(
@@ -301,8 +301,6 @@ async def receive_response(
301301
message=("Connection closed"),
302302
)
303303
)
304-
except TimeoutError:
305-
return None
306304

307305
async def handle_response(self, message: JSONRPCResponse | JSONRPCError) -> bool:
308306
send_stream, _ = self._response_streams.get(message.id, [None, None])

0 commit comments

Comments
 (0)