feat(gateway): schedule gateway maintenance tasks

This commit is contained in:
Anish Sarkar 2026-05-27 23:40:47 +05:30
parent d32e8c6a90
commit a428f6c05f
2 changed files with 158 additions and 0 deletions

View file

@ -188,6 +188,7 @@ celery_app = Celery(
"app.tasks.celery_tasks.document_reindex_tasks",
"app.tasks.celery_tasks.stale_notification_cleanup_task",
"app.tasks.celery_tasks.stripe_reconciliation_task",
"app.tasks.celery_tasks.gateway_tasks",
],
)
@ -242,6 +243,10 @@ celery_app.conf.update(
"index_obsidian_attachment": {"queue": CONNECTORS_QUEUE},
# Everything else (document processing, podcasts, reindexing,
# schedule checker, cleanup) stays on the default fast queue.
"gateway.process_inbound_event": {"queue": f"{CELERY_TASK_DEFAULT_QUEUE}.gateway"},
"gateway.reconcile_inbox": {"queue": f"{CELERY_TASK_DEFAULT_QUEUE}.gateway"},
"gateway.health_check": {"queue": f"{CELERY_TASK_DEFAULT_QUEUE}.gateway"},
"gateway.retention_sweep": {"queue": f"{CELERY_TASK_DEFAULT_QUEUE}.gateway"},
},
)
@ -282,4 +287,19 @@ celery_app.conf.beat_schedule = {
"expires": 60,
},
},
"gateway-reconcile-inbox": {
"task": "gateway.reconcile_inbox",
"schedule": crontab(minute="*"),
"options": {"expires": 60},
},
"gateway-health-check": {
"task": "gateway.health_check",
"schedule": crontab(minute="*/5"),
"options": {"expires": 120},
},
"gateway-retention-sweep": {
"task": "gateway.retention_sweep",
"schedule": crontab(hour="3", minute="17"),
"options": {"expires": 600},
},
}