refactor: remove some async in ServerHandlers (#6057)

* refactor: remove some async in ServerHandlers

* address PR comments
This commit is contained in:
LFC
2025-05-07 11:57:16 +08:00
committed by GitHub
parent 56f31d5933
commit 4b5ab75312
30 changed files with 291 additions and 360 deletions

View File

@@ -129,7 +129,7 @@ impl Datanode {
self.services = services;
}
pub async fn shutdown(&self) -> Result<()> {
pub async fn shutdown(&mut self) -> Result<()> {
self.services
.shutdown_all()
.await

View File

@@ -62,7 +62,7 @@ impl<'a> DatanodeServiceBuilder<'a> {
}
}
pub async fn build(mut self) -> Result<ServerHandlers> {
pub fn build(mut self) -> Result<ServerHandlers> {
let handlers = ServerHandlers::default();
if let Some(grpc_server) = self.grpc_server.take() {
@@ -70,7 +70,7 @@ impl<'a> DatanodeServiceBuilder<'a> {
addr: &self.opts.grpc.bind_addr,
})?;
let handler: ServerHandler = (Box::new(grpc_server), addr);
handlers.insert(handler).await;
handlers.insert(handler);
}
if self.enable_http_service {
@@ -82,7 +82,7 @@ impl<'a> DatanodeServiceBuilder<'a> {
addr: &self.opts.http.addr,
})?;
let handler: ServerHandler = (Box::new(http_server), addr);
handlers.insert(handler).await;
handlers.insert(handler);
}
Ok(handlers)