mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-10 05:05:34 +02:00
Fix Remove Index Attempt (#1091)
This commit is contained in:
@@ -244,20 +244,15 @@ def cancel_indexing_attempts_for_connector(
|
|||||||
db_session: Session,
|
db_session: Session,
|
||||||
include_secondary_index: bool = False,
|
include_secondary_index: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
subquery = select(EmbeddingModel.id).where(
|
stmt = delete(IndexAttempt).where(
|
||||||
EmbeddingModel.status != IndexModelStatus.FUTURE
|
IndexAttempt.connector_id == connector_id,
|
||||||
)
|
IndexAttempt.status == IndexingStatus.NOT_STARTED,
|
||||||
|
|
||||||
stmt = (
|
|
||||||
update(IndexAttempt)
|
|
||||||
.where(
|
|
||||||
IndexAttempt.connector_id == connector_id,
|
|
||||||
IndexAttempt.status == IndexingStatus.NOT_STARTED,
|
|
||||||
)
|
|
||||||
.values(status=IndexingStatus.FAILED)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if not include_secondary_index:
|
if not include_secondary_index:
|
||||||
|
subquery = select(EmbeddingModel.id).where(
|
||||||
|
EmbeddingModel.status != IndexModelStatus.FUTURE
|
||||||
|
)
|
||||||
stmt = stmt.where(IndexAttempt.embedding_model_id.in_(subquery))
|
stmt = stmt.where(IndexAttempt.embedding_model_id.in_(subquery))
|
||||||
|
|
||||||
db_session.execute(stmt)
|
db_session.execute(stmt)
|
||||||
|
Reference in New Issue
Block a user