From 381b02a4d02ffcca654600a5d28f71eeda1b73f8 Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Mon, 23 Dec 2024 00:04:25 +0800 Subject: [PATCH] chore: disable batch index (#1098) --- .../src/indexer/indexer_scheduler.rs | 5 ++- src/api/workspace.rs | 34 +++++++++---------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/services/appflowy-collaborate/src/indexer/indexer_scheduler.rs b/services/appflowy-collaborate/src/indexer/indexer_scheduler.rs index efadc0152..7ca4f2053 100644 --- a/services/appflowy-collaborate/src/indexer/indexer_scheduler.rs +++ b/services/appflowy-collaborate/src/indexer/indexer_scheduler.rs @@ -33,6 +33,7 @@ use uuid::Uuid; pub struct IndexerScheduler { indexer_provider: Arc, pg_pool: PgPool, + #[allow(dead_code)] storage: Arc, threads: Arc, #[allow(dead_code)] @@ -107,7 +108,7 @@ impl IndexerScheduler { this.pg_pool.clone(), this.metrics.clone(), )); - tokio::spawn(handle_unindexed_collabs(this.clone())); + // tokio::spawn(handle_unindexed_collabs(this.clone())); } this @@ -396,6 +397,7 @@ fn should_embed( should_embed } +#[allow(dead_code)] async fn handle_unindexed_collabs(scheduler: Arc) { // wait for 30 seconds before starting indexing tokio::time::sleep(tokio::time::Duration::from_secs(30)).await; @@ -479,6 +481,7 @@ pub async fn get_unindexed_collabs( .boxed() } +#[allow(dead_code)] async fn index_unindexd_collab( embedder: Embedder, indexer_provider: &Arc, diff --git a/src/api/workspace.rs b/src/api/workspace.rs index e18182a8a..2e24d4dd0 100644 --- a/src/api/workspace.rs +++ b/src/api/workspace.rs @@ -837,23 +837,23 @@ async fn batch_create_collab_handler( start.elapsed() ); - if state - .indexer_scheduler - .can_index_workspace(&workspace_id) - .await? - { - let indexed_collabs: Vec<_> = collab_params_list - .iter() - .filter(|p| state.indexer_scheduler.is_indexing_enabled(&p.collab_type)) - .map(IndexedCollab::from) - .collect(); - - if !indexed_collabs.is_empty() { - state - .indexer_scheduler - .index_encoded_collabs(&workspace_id, indexed_collabs)?; - } - } + // if state + // .indexer_scheduler + // .can_index_workspace(&workspace_id) + // .await? + // { + // let indexed_collabs: Vec<_> = collab_params_list + // .iter() + // .filter(|p| state.indexer_scheduler.is_indexing_enabled(&p.collab_type)) + // .map(IndexedCollab::from) + // .collect(); + // + // if !indexed_collabs.is_empty() { + // state + // .indexer_scheduler + // .index_encoded_collabs(&workspace_id, indexed_collabs)?; + // } + // } let start = Instant::now(); state