mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-05 20:21:02 +02:00
Only Log Index Attempt CC Pair Miscount (#1355)
This commit is contained in:
@ -295,6 +295,9 @@ def count_unique_cc_pairs_with_successful_index_attempts(
|
|||||||
embedding_model_id: int | None,
|
embedding_model_id: int | None,
|
||||||
db_session: Session,
|
db_session: Session,
|
||||||
) -> int:
|
) -> int:
|
||||||
|
"""Collect all of the Index Attempts that are successful and for the specified embedding model
|
||||||
|
Then do distinct by connector_id and credential_id which is equivalent to the cc-pair. Finally,
|
||||||
|
do a count to get the total number of unique cc-pairs with successful attempts"""
|
||||||
unique_pairs_count = (
|
unique_pairs_count = (
|
||||||
db_session.query(IndexAttempt.connector_id, IndexAttempt.credential_id)
|
db_session.query(IndexAttempt.connector_id, IndexAttempt.credential_id)
|
||||||
.filter(
|
.filter(
|
||||||
|
@ -31,8 +31,10 @@ def check_index_swap(db_session: Session) -> None:
|
|||||||
embedding_model_id=embedding_model.id, db_session=db_session
|
embedding_model_id=embedding_model.id, db_session=db_session
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Index Attempts are cleaned up as well when the cc-pair is deleted so the logic in this
|
||||||
|
# function is correct. The unique_cc_indexings are specifically for the existing cc-pairs
|
||||||
if unique_cc_indexings > cc_pair_count:
|
if unique_cc_indexings > cc_pair_count:
|
||||||
raise RuntimeError("More unique indexings than cc pairs, should not occur")
|
logger.error("More unique indexings than cc pairs, should not occur")
|
||||||
|
|
||||||
if cc_pair_count == 0 or cc_pair_count == unique_cc_indexings:
|
if cc_pair_count == 0 or cc_pair_count == unique_cc_indexings:
|
||||||
# Swap indices
|
# Swap indices
|
||||||
|
Reference in New Issue
Block a user