Skip to content

Commit 1caf543

Browse files
committed
Fix Bug #7: Remove logger call from message processing loop
Removed await logger?.debug() at line 207 in the for-await message loop. This was causing delays when processing every incoming message, including tool call responses. Line 207 was in the hot path - executed for EVERY message received.
1 parent 7a6ddf9 commit 1caf543

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/MCP/Client/Client.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ public actor Client {
203203
do {
204204
for try await data in stream {
205205
NSLog("🔵 CLIENT: Received data in loop - \(data.count) bytes")
206-
// Keep this one - it's after we receive data so no race condition
207-
await logger?.debug("CLIENT: Received data in loop", metadata: ["size": "\(data.count)"])
206+
// REMOVED: await logger?.debug() - causes delay in message processing loop
207+
// await logger?.debug("CLIENT: Received data in loop", metadata: ["size": "\(data.count)"])
208208
if Task.isCancelled { break }
209209

210210
// Attempt to decode data

0 commit comments

Comments
 (0)