From 108b3520de606a8f6dc78cd11f209b24f670c6de Mon Sep 17 00:00:00 2001 From: ad hoc Date: Tue, 7 Jun 2022 10:44:13 +0200 Subject: [PATCH] fix blocking auth controller dump --- meilisearch-lib/src/dump/handler.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/meilisearch-lib/src/dump/handler.rs b/meilisearch-lib/src/dump/handler.rs index 16bfd6a55..faa146867 100644 --- a/meilisearch-lib/src/dump/handler.rs +++ b/meilisearch-lib/src/dump/handler.rs @@ -16,7 +16,8 @@ pub fn generate_uid() -> String { } mod real { - use std::{fs::File, path::PathBuf, sync::Arc}; + use std::path::PathBuf; + use std::sync::Arc; use log::{info, trace}; use meilisearch_auth::AuthController; @@ -88,8 +89,13 @@ mod real { create_dir_all(&temp_dump_path.join("indexes")).await?; - // TODO: this is blocking!! - AuthController::dump(&self.db_path, &temp_dump_path)?; + let db_path = self.db_path.clone(); + let temp_dump_path_clone = temp_dump_path.clone(); + tokio::task::spawn_blocking(move || -> Result<()> { + AuthController::dump(db_path, temp_dump_path_clone)?; + Ok(()) + }) + .await??; TaskStore::dump( self.env.clone(), &temp_dump_path,