Skip to content

Commit

Permalink
chore: update metrics and num threads (#1102)
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy authored Dec 26, 2024
1 parent b8e9aa0 commit c804912
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions libs/indexer/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,17 @@ fn process_collab(
metrics: &EmbeddingMetrics,
) -> Result<Option<(u32, Vec<AFCollabEmbeddedChunk>)>, 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))),
Expand Down
2 changes: 1 addition & 1 deletion services/appflowy-worker/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/api/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ async fn update_collab_handler(
);
state
.indexer_scheduler
.index_pending_collab_one(pending, false)?;
.index_pending_collab_one(pending, true)?;
}
},
_ => {
Expand Down

0 comments on commit c804912

Please sign in to comment.