Skip to content

Commit 1909f22

Browse files
committed
Fix actor isolation in timeout wrapper - add missing await keywords
1 parent 58e4aa4 commit 1909f22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/MCP/Client/Client.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public actor Client {
336336
Task {
337337
NSLog("🔵 CLIENT.send() - Task started, adding pending request")
338338
// Add the pending request before attempting to send
339-
self.addPendingRequest(
339+
await self.addPendingRequest(
340340
id: request.id,
341341
continuation: continuation,
342342
type: M.Result.self
@@ -353,7 +353,7 @@ public actor Client {
353353
// If send fails, try to remove the pending request.
354354
// Resume with the send error only if we successfully removed the request,
355355
// indicating the response handler hasn't processed it yet.
356-
if self.removePendingRequest(id: request.id) != nil {
356+
if await self.removePendingRequest(id: request.id) != nil {
357357
continuation.resume(throwing: error)
358358
}
359359
// Otherwise, the request was already removed by the response handler
@@ -378,7 +378,7 @@ public actor Client {
378378
return result
379379
} catch {
380380
// Clean up pending request on timeout
381-
_ = self.removePendingRequest(id: request.id)
381+
_ = await self.removePendingRequest(id: request.id)
382382
throw error
383383
}
384384
}

0 commit comments

Comments
 (0)