mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-05-06 16:25:04 +00:00
feat: make version check periodic
This commit is contained in:
@@ -140,6 +140,11 @@ def setup_periodic_tasks(sender, **kwargs):
|
||||
cleanup_pending_tool_state.s(),
|
||||
name="cleanup-pending-tool-state",
|
||||
)
|
||||
sender.add_periodic_task(
|
||||
timedelta(hours=7),
|
||||
version_check_task.s(),
|
||||
name="version-check",
|
||||
)
|
||||
|
||||
|
||||
@celery.task(bind=True)
|
||||
@@ -176,3 +181,16 @@ def cleanup_pending_tool_state(self):
|
||||
with engine.begin() as conn:
|
||||
deleted = PendingToolStateRepository(conn).cleanup_expired()
|
||||
return {"deleted": deleted}
|
||||
|
||||
|
||||
@celery.task(bind=True)
|
||||
def version_check_task(self):
|
||||
"""Periodic anonymous version check.
|
||||
|
||||
Complements the ``worker_ready`` boot trigger so long-running
|
||||
deployments (>6h cache TTL) still refresh advisories. ``run_check``
|
||||
is fail-silent and coordinates across replicas via Redis lock +
|
||||
cache (see ``application.updates.version_check``).
|
||||
"""
|
||||
from application.updates.version_check import run_check
|
||||
run_check()
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""Anonymous startup version-check client.
|
||||
"""Anonymous version-check client.
|
||||
|
||||
Called once per Celery worker boot (see ``application/celery_init.py``
|
||||
``worker_ready`` handler). Posts the running version + anonymous
|
||||
instance UUID to ``gptcloud.arc53.com/api/check``, caches the response
|
||||
in Redis, and surfaces any advisories to stdout + logs.
|
||||
Fired on every Celery worker boot (see ``application/celery_init.py``
|
||||
``worker_ready`` handler) and on a 7h periodic schedule (see the
|
||||
``version-check`` entry in ``application/api/user/tasks.py``). Posts
|
||||
the running version + anonymous instance UUID to
|
||||
``gptcloud.arc53.com/api/check``, caches the response in Redis, and
|
||||
surfaces any advisories to stdout + logs.
|
||||
|
||||
Design invariants — all enforced by a broad ``try/except`` at the top
|
||||
of :func:`run_check`:
|
||||
|
||||
Reference in New Issue
Block a user