Skip to content

Commit

Permalink
fix: WAIT should return error if timeout (#13045)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Oct 25, 2023
1 parent e48547d commit 09a67ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/meta/service/src/ddl_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ impl DdlService for DdlServiceImpl {
}

async fn wait(&self, _request: Request<WaitRequest>) -> Result<Response<WaitResponse>, Status> {
self.ddl_controller.wait().await;
self.ddl_controller.wait().await?;
Ok(Response::new(WaitResponse {}))
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/meta/src/rpc/ddl_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,17 +1097,18 @@ impl DdlController {
}
}

pub async fn wait(&self) {
pub async fn wait(&self) -> MetaResult<()> {
for _ in 0..30 * 60 {
if self
.catalog_manager
.list_creating_background_mvs()
.await
.is_empty()
{
break;
return Ok(());
}
sleep(Duration::from_secs(1)).await;
}
Err(MetaError::cancelled("timeout".into()))
}
}

0 comments on commit 09a67ab

Please sign in to comment.