This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from celery import shared_task
|
||||
from django.core.cache import cache
|
||||
from django.utils import timezone
|
||||
|
||||
RUNTIME_HEARTBEAT_KEY = "vacatureradar:runtime:heartbeat"
|
||||
RUNTIME_HEARTBEAT_TTL_SECONDS = 180
|
||||
|
||||
|
||||
@shared_task(name="apps.core.tasks.record_runtime_heartbeat", ignore_result=True)
|
||||
def record_runtime_heartbeat() -> str:
|
||||
"""Record proof that beat dispatch and a worker execution both succeeded."""
|
||||
|
||||
timestamp = timezone.now().isoformat()
|
||||
cache.set(RUNTIME_HEARTBEAT_KEY, timestamp, timeout=RUNTIME_HEARTBEAT_TTL_SECONDS)
|
||||
return timestamp
|
||||
Reference in New Issue
Block a user