From 8286d63f33ab8c48b94580f39490be049a168f5b Mon Sep 17 00:00:00 2001 From: Noel Kwan Date: Wed, 25 Oct 2023 12:59:39 +0800 Subject: [PATCH] return timeout cancel on failure --- src/meta/service/src/ddl_service.rs | 2 +- src/meta/src/rpc/ddl_controller.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/meta/service/src/ddl_service.rs b/src/meta/service/src/ddl_service.rs index 061ff93589163..fac8f89e17b11 100644 --- a/src/meta/service/src/ddl_service.rs +++ b/src/meta/service/src/ddl_service.rs @@ -734,7 +734,7 @@ impl DdlService for DdlServiceImpl { } async fn wait(&self, _request: Request) -> Result, Status> { - self.ddl_controller.wait().await; + self.ddl_controller.wait().await?; Ok(Response::new(WaitResponse {})) } } diff --git a/src/meta/src/rpc/ddl_controller.rs b/src/meta/src/rpc/ddl_controller.rs index 36615bd93b757..629bfcad902ef 100644 --- a/src/meta/src/rpc/ddl_controller.rs +++ b/src/meta/src/rpc/ddl_controller.rs @@ -1097,7 +1097,7 @@ impl DdlController { } } - pub async fn wait(&self) { + pub async fn wait(&self) -> MetaResult<()> { for _ in 0..30 * 60 { if self .catalog_manager @@ -1105,9 +1105,10 @@ impl DdlController { .await .is_empty() { - break; + return Ok(()); } sleep(Duration::from_secs(1)).await; } + return Err(MetaError::cancelled("timeout".into())); } }