fix: do not throw errors if indexer found document before workspace was created
This commit is contained in:
parent
0f9fcf2042
commit
2ff2a77465
|
|
@ -2,7 +2,7 @@ use std::ops::DerefMut;
|
||||||
|
|
||||||
use collab_entity::CollabType;
|
use collab_entity::CollabType;
|
||||||
use pgvector::Vector;
|
use pgvector::Vector;
|
||||||
use sqlx::{Executor, Postgres, Transaction};
|
use sqlx::{Error, Executor, Postgres, Transaction};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use database_entity::dto::AFCollabEmbeddingParams;
|
use database_entity::dto::AFCollabEmbeddingParams;
|
||||||
|
|
@ -27,11 +27,23 @@ WHERE c.oid = $1"#,
|
||||||
oid
|
oid
|
||||||
)
|
)
|
||||||
.fetch_one(tx.deref_mut())
|
.fetch_one(tx.deref_mut())
|
||||||
.await?;
|
.await;
|
||||||
if result.disable_search_indexing.unwrap_or(false) {
|
match result {
|
||||||
return Ok(None);
|
Ok(row) => {
|
||||||
|
if row.disable_search_indexing.unwrap_or(false) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
Ok(Some(row.has_index.unwrap_or(false)))
|
||||||
|
},
|
||||||
|
Err(Error::RowNotFound) => {
|
||||||
|
tracing::warn!(
|
||||||
|
"open-collab event for {} arrived before its workspace was created",
|
||||||
|
oid
|
||||||
|
);
|
||||||
|
Ok(Some(false))
|
||||||
|
},
|
||||||
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
Ok(Some(result.has_index.unwrap_or(false)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn upsert_collab_embeddings(
|
pub async fn upsert_collab_embeddings(
|
||||||
|
|
|
||||||
|
|
@ -240,8 +240,8 @@ impl OpenCollabConsumer {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
"failed to open handle for {}/{}: {}",
|
"failed to open handle for {}/{}: {}",
|
||||||
object_id,
|
|
||||||
workspace_id,
|
workspace_id,
|
||||||
|
object_id,
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue