chore: update metrics and num threads (#1102)

This commit is contained in:
Nathan.fooo 2024-12-26 11:55:54 +08:00 committed by GitHub
parent b8e9aa0291
commit c80491267b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -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))),

View File

@ -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(),

View File

@ -1466,7 +1466,7 @@ async fn update_collab_handler(
);
state
.indexer_scheduler
.index_pending_collab_one(pending, false)?;
.index_pending_collab_one(pending, true)?;
}
},
_ => {