Phase 0 go-live polish: hands-off incremental sync + refresh action
- backend/ingest/sync_scheduler.py: periodic incremental-sync loop (every CRM_INGEST_SYNC_INTERVAL_MIN min); resilient, --once for testing. - start9/0.4: "Refresh search index" action (incremental sync.py); entrypoint launches the scheduler as a background process when Spark/Qdrant are set; CRM_INGEST_SYNC_INTERVAL_MIN env; pre-release note on fastembed/mcp pins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,23 @@ export CRM_DB_PATH="${CRM_DB_PATH:-$DATA_DIR/crm.db}"
|
||||
export SPARK_CONTROL_URL="${SPARK_CONTROL_URL:-https://192.168.1.72:62419}"
|
||||
export SPARK_CONTROL_VERIFY_TLS="${SPARK_CONTROL_VERIFY_TLS:-false}"
|
||||
export QDRANT_URL="${QDRANT_URL:-http://192.168.1.87:6333}"
|
||||
# OPERATOR: how often (minutes) the background sync scheduler re-runs the
|
||||
# incremental ingest sync to keep the Qdrant search index fresh. Default 60.
|
||||
export CRM_INGEST_SYNC_INTERVAL_MIN="${CRM_INGEST_SYNC_INTERVAL_MIN:-60}"
|
||||
|
||||
# ── Background ingest sync scheduler ────────────────────────────
|
||||
# Keep the Qdrant search index fresh hands-off: sync_scheduler.py loops the
|
||||
# incremental sync every CRM_INGEST_SYNC_INTERVAL_MIN minutes. It runs as a
|
||||
# BACKGROUND process (not a StartOS daemon) — see INGEST_PACKAGING.md for the
|
||||
# daemon-vs-background-process tradeoff. Started only when ingest is configured,
|
||||
# i.e. both Spark Control and Qdrant endpoints are set; otherwise the loop would
|
||||
# just error every interval with nothing to talk to.
|
||||
if [ -n "${SPARK_CONTROL_URL:-}" ] && [ -n "${QDRANT_URL:-}" ]; then
|
||||
(cd /app/backend/ingest && CRM_DB_PATH=/data/crm.db python3 sync_scheduler.py --db /data/crm.db >> /data/ingest-sync.log 2>&1 &)
|
||||
echo "[entrypoint] ingest sync scheduler: STARTED"
|
||||
else
|
||||
echo "[entrypoint] ingest sync scheduler: SKIPPED (Spark/Qdrant not configured)"
|
||||
fi
|
||||
|
||||
# ── Launch the app ──────────────────────────────────────────────
|
||||
exec python3 /app/backend/server.py
|
||||
|
||||
Reference in New Issue
Block a user