mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 23:32:55 +00:00
fix(grpc): check grpc client unavailable (#6488)
* fix/check-grpc-client-unavailable: Improve async handling in `greptime_handler.rs` - Updated the `DoPut` response handling to use `await` with `result_sender.send` for better asynchronous operation. Signed-off-by: Lei, HUANG <mrsatangel@gmail.com> * fix/check-grpc-client-unavailable: ### Improve Error Handling in `greptime_handler.rs` - Enhanced error handling for the `DoPut` operation by switching from `send` to `try_send` for the `result_sender`. - Added specific logging for unreachable clients, including `request_id` in the warning message. Signed-off-by: Lei, HUANG <mrsatangel@gmail.com> --------- Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
This commit is contained in:
@@ -42,6 +42,7 @@ use session::hints::READ_PREFERENCE_HINT;
|
||||
use snafu::{OptionExt, ResultExt};
|
||||
use table::TableRef;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::mpsc::error::TrySendError;
|
||||
|
||||
use crate::error::Error::UnsupportedAuthScheme;
|
||||
use crate::error::{
|
||||
@@ -176,8 +177,9 @@ impl GreptimeRequestHandler {
|
||||
let result = result
|
||||
.map(|x| DoPutResponse::new(request_id, x))
|
||||
.map_err(Into::into);
|
||||
if result_sender.try_send(result).is_err() {
|
||||
warn!(r#""DoPut" client maybe unreachable, abort handling its message"#);
|
||||
if let Err(e)= result_sender.try_send(result)
|
||||
&& let TrySendError::Closed(_) = e {
|
||||
warn!(r#""DoPut" client with request_id {} maybe unreachable, abort handling its message"#, request_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user