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())); } }