feat: complete published registry contracts and gated SRO ingestion
All checks were successful
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m55s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Successful in 3m43s
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped
Mostovik Backend CI/CD / Deploy customer main (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Successful in 1m45s
All checks were successful
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m55s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Successful in 3m43s
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped
Mostovik Backend CI/CD / Deploy customer main (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Successful in 1m45s
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import math
|
||||
from dataclasses import asdict
|
||||
|
||||
from apps.core.tasks import PeriodicTask as CorePeriodicTask
|
||||
from celery import shared_task
|
||||
from celery.exceptions import MaxRetriesExceededError
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
|
||||
@@ -29,8 +31,18 @@ def refresh_source_record_export_artifacts(self) -> dict: # noqa: ARG001
|
||||
getattr(settings, "SOURCE_RECORD_EXPORT_LOCK_TTL_SECONDS", 6 * 60 * 60)
|
||||
)
|
||||
if not cache.add(lock_key, "1", timeout=lock_ttl):
|
||||
logger.info("Source-record export generation skipped: lock is already held")
|
||||
return {"status": "skipped", "reason": "locked"}
|
||||
# Every successful registry publication requests a rebuild. Dropping a
|
||||
# request here can leave the in-flight generation stale until tomorrow.
|
||||
# Retry beyond one full lease so a killed builder's lock can expire too.
|
||||
countdown = 30
|
||||
max_retries = max(1, math.ceil(lock_ttl / countdown) + 2)
|
||||
try:
|
||||
raise self.retry(countdown=countdown, max_retries=max_retries)
|
||||
except MaxRetriesExceededError:
|
||||
logger.error(
|
||||
"Source-record export retry budget exhausted while waiting for build lock"
|
||||
)
|
||||
raise
|
||||
|
||||
try:
|
||||
generation = build_source_record_export_artifacts()
|
||||
|
||||
Reference in New Issue
Block a user