mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-28 21:49:40 +02:00
fix(calendar): fail skipped placeholders so they don't stay pending
This commit is contained in:
parent
b2c2fc9c2e
commit
1b0912aaa3
1 changed files with 18 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ from .base import (
|
||||||
check_duplicate_document_by_hash,
|
check_duplicate_document_by_hash,
|
||||||
get_connector_by_id,
|
get_connector_by_id,
|
||||||
logger,
|
logger,
|
||||||
|
mark_connector_documents_failed,
|
||||||
parse_date_flexible,
|
parse_date_flexible,
|
||||||
update_connector_last_indexed,
|
update_connector_last_indexed,
|
||||||
)
|
)
|
||||||
|
|
@ -448,6 +449,23 @@ async def index_google_calendar_events(
|
||||||
heartbeat_interval=HEARTBEAT_INTERVAL_SECONDS,
|
heartbeat_interval=HEARTBEAT_INTERVAL_SECONDS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Placeholders for items skipped above (empty/duplicate/unbuildable) would
|
||||||
|
# otherwise stay stuck in 'pending' and undeletable. Fail them so they're
|
||||||
|
# recoverable. Leaves already-ready docs untouched.
|
||||||
|
indexed_ids = {doc.unique_id for doc in connector_docs}
|
||||||
|
stuck_placeholders = [
|
||||||
|
(p.unique_id, "Skipped during sync: no indexable content")
|
||||||
|
for p in placeholders
|
||||||
|
if p.unique_id and p.unique_id not in indexed_ids
|
||||||
|
]
|
||||||
|
if stuck_placeholders:
|
||||||
|
await mark_connector_documents_failed(
|
||||||
|
session,
|
||||||
|
document_type=DocumentType.GOOGLE_CALENDAR_CONNECTOR,
|
||||||
|
search_space_id=search_space_id,
|
||||||
|
failures=stuck_placeholders,
|
||||||
|
)
|
||||||
|
|
||||||
# ── Finalize ──────────────────────────────────────────────────
|
# ── Finalize ──────────────────────────────────────────────────
|
||||||
await update_connector_last_indexed(session, connector, update_last_indexed)
|
await update_connector_last_indexed(session, connector, update_last_indexed)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue