mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-28 05:43:33 +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,
|
||||
include_secondary_index: bool = False,
|
||||
) -> None:
|
||||
subquery = select(EmbeddingModel.id).where(
|
||||
EmbeddingModel.status != IndexModelStatus.FUTURE
|
||||
)
|
||||
|
||||
stmt = (
|
||||
update(IndexAttempt)
|
||||
.where(
|
||||
IndexAttempt.connector_id == connector_id,
|
||||
IndexAttempt.status == IndexingStatus.NOT_STARTED,
|
||||
)
|
||||
.values(status=IndexingStatus.FAILED)
|
||||
stmt = delete(IndexAttempt).where(
|
||||
IndexAttempt.connector_id == connector_id,
|
||||
IndexAttempt.status == IndexingStatus.NOT_STARTED,
|
||||
)
|
||||
|
||||
if not include_secondary_index:
|
||||
subquery = select(EmbeddingModel.id).where(
|
||||
EmbeddingModel.status != IndexModelStatus.FUTURE
|
||||
)
|
||||
stmt = stmt.where(IndexAttempt.embedding_model_id.in_(subquery))
|
||||
|
||||
db_session.execute(stmt)
|
||||
|
Reference in New Issue
Block a user