Copilot commented on code in PR #407:
URL: https://github.com/apache/fluss-rust/pull/407#discussion_r2902787869
##########
crates/fluss/src/rpc/server_connection.rs:
##########
@@ -386,12 +470,34 @@ where
ConnectionState::Poison(e) => return
Err(RpcError::Poisoned(Arc::clone(e)).into()),
}
- self.send_message(buf).await?;
+ // count only the API message body, excluding the protocol header.
+ let request_body_bytes =
buf.len().saturating_sub(REQUEST_HEADER_LENGTH) as u64;
+ let mut request_metrics = RequestMetricsLifecycle::begin(R::API_KEY,
request_body_bytes);
+
+ if let Err(e) = self.send_message(buf).await {
+ request_metrics.complete(0);
+ return Err(e.into());
+ }
_cleanup_on_cancel.message_sent();
- let mut response = rx.await.map_err(|e| Error::UnexpectedError {
- message: "Got recvError, some one close the channel".to_string(),
- source: Some(Box::new(e)),
- })??;
+ let mut response = match rx.await {
+ Ok(Ok(response)) => response,
+ Ok(Err(e)) => {
+ request_metrics.complete(0);
+ return Err(e.into());
+ }
+ Err(e) => {
+ request_metrics.complete(0);
+ return Err(Error::UnexpectedError {
+ message: "Got recvError, some one close the
channel".to_string(),
Review Comment:
The error message string has spelling/grammar issues ("recvError", "some one
close"). Please reword to a clear, grammatically correct message (e.g.,
"receive error: channel closed" / "receiver dropped").
```suggestion
message: "receive error: response channel
closed".to_string(),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]