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

This commit is contained in:
Aleksandr Meshchryakov
2026-09-14 17:01:02 +02:00
parent 49cbfd265c
commit 18971d33ec
76 changed files with 33156 additions and 311 deletions

View File

@@ -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()