Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions backend/onyx/background/celery/tasks/docprocessing/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from onyx.configs.constants import INDEXING_WORKER_HEARTBEAT_INTERVAL
from onyx.db.engine.sql_engine import get_session_with_current_tenant
from onyx.db.models import IndexAttempt
from onyx.utils.logger import setup_logger

logger = setup_logger()


def start_heartbeat(index_attempt_id: int) -> tuple[threading.Thread, threading.Event]:
Expand All @@ -21,9 +24,15 @@ def heartbeat_loop() -> None:
.values(heartbeat_counter=IndexAttempt.heartbeat_counter + 1)
)
db_session.commit()
logger.debug(
"Updated heartbeat counter for index attempt %s",
index_attempt_id,
)
except Exception:
# Silently continue if heartbeat fails
pass
logger.exception(
"Failed to update heartbeat counter for index attempt %s",
index_attempt_id,
)

thread = threading.Thread(target=heartbeat_loop, daemon=True)
thread.start()
Expand Down
Loading