fix: remove unnecessary flush() calls (#2873)

Because we are writing to a pipe, these `flush()` calls are unnecessary,
so removing these saves us one syscall per write in these two cases.
This commit is contained in:
Michael Bolin
2025-08-28 22:41:10 -07:00
committed by GitHub
parent 7d734bff65
commit cb2f952143
2 changed files with 1 additions and 8 deletions

View File

@@ -129,10 +129,7 @@ impl McpClient {
error!("failed to write newline to child stdin");
break;
}
if stdin.flush().await.is_err() {
error!("failed to flush child stdin");
break;
}
// No explicit flush needed on a pipe; write_all is sufficient.
}
Err(e) => error!("failed to serialize JSONRPCMessage: {e}"),
}

View File

@@ -134,10 +134,6 @@ pub async fn run_main(
error!("Failed to write newline to stdout: {e}");
break;
}
if let Err(e) = stdout.flush().await {
error!("Failed to flush stdout: {e}");
break;
}
}
Err(e) => error!("Failed to serialize JSONRPCMessage: {e}"),
}