diff --git a/libs/indexer/src/scheduler.rs b/libs/indexer/src/scheduler.rs index aae3d9ac5..f92fdf212 100644 --- a/libs/indexer/src/scheduler.rs +++ b/libs/indexer/src/scheduler.rs @@ -490,14 +490,17 @@ fn process_collab( metrics: &EmbeddingMetrics, ) -> Result)>, AppError> { if let Some(indexer) = indexer { - metrics.record_embed_count(1); - let chunks = match data { UnindexedData::UnindexedText(text) => { indexer.create_embedded_chunks_from_text(object_id.to_string(), text, embedder.model())? }, }; + if chunks.is_empty() { + return Ok(None); + } + + metrics.record_embed_count(1); let result = indexer.embed(embedder, chunks); match result { Ok(Some(embeddings)) => Ok(Some((embeddings.tokens_consumed, embeddings.params))), diff --git a/services/appflowy-worker/src/application.rs b/services/appflowy-worker/src/application.rs index 923826656..af46212a9 100644 --- a/services/appflowy-worker/src/application.rs +++ b/services/appflowy-worker/src/application.rs @@ -129,7 +129,7 @@ pub async fn create_app(listener: TcpListener, config: Config) -> Result<(), Err let threads = Arc::new( ThreadPoolNoAbortBuilder::new() - .num_threads(20) + .num_threads(30) .thread_name(|index| format!("background-embedding-thread-{index}")) .build() .unwrap(), diff --git a/src/api/workspace.rs b/src/api/workspace.rs index 36a94e8b2..882299fe5 100644 --- a/src/api/workspace.rs +++ b/src/api/workspace.rs @@ -1466,7 +1466,7 @@ async fn update_collab_handler( ); state .indexer_scheduler - .index_pending_collab_one(pending, false)?; + .index_pending_collab_one(pending, true)?; } }, _ => {