Skip to content

Commit

Permalink
chore: disable batch index (#1098)
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy authored Dec 22, 2024
1 parent 5ea714b commit 381b02a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use uuid::Uuid;
pub struct IndexerScheduler {
indexer_provider: Arc<IndexerProvider>,
pg_pool: PgPool,
#[allow(dead_code)]
storage: Arc<dyn CollabStorage>,
threads: Arc<ThreadPoolNoAbort>,
#[allow(dead_code)]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -396,6 +397,7 @@ fn should_embed(
should_embed
}

#[allow(dead_code)]
async fn handle_unindexed_collabs(scheduler: Arc<IndexerScheduler>) {
// wait for 30 seconds before starting indexing
tokio::time::sleep(tokio::time::Duration::from_secs(30)).await;
Expand Down Expand Up @@ -479,6 +481,7 @@ pub async fn get_unindexed_collabs(
.boxed()
}

#[allow(dead_code)]
async fn index_unindexd_collab(
embedder: Embedder,
indexer_provider: &Arc<IndexerProvider>,
Expand Down
34 changes: 17 additions & 17 deletions src/api/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 381b02a

Please sign in to comment.