predzadnji unstagaeni dijelovi
Some checks failed
ERP CI/CD Pipeline / test (push) Has been cancelled
ERP CI/CD Pipeline / Deploy (server git pull + compose) (push) Has been cancelled

This commit is contained in:
mariomitte
2026-08-07 10:10:37 +02:00
parent f37d130bc7
commit 38f1786469
7 changed files with 320 additions and 50 deletions

View File

@@ -3055,10 +3055,17 @@ def _request_monthly_archive_generation(*, request, archive_type):
.first()
)
if existing_pending:
return {
'status': 'processing',
'generated_archive_id': str(existing_pending.pk),
}
stale_pending_threshold = timezone.now() - timedelta(minutes=3)
if existing_pending.created_at and existing_pending.created_at < stale_pending_threshold:
existing_pending.is_active = False
existing_pending.status = 'failed'
existing_pending.error_message = 'ZIP zahtjev je ostao predugo u pending statusu; pokrece se novi zahtjev.'
existing_pending.save(update_fields=['is_active', 'status', 'error_message', 'updated_at'])
else:
return {
'status': 'processing',
'generated_archive_id': str(existing_pending.pk),
}
generated_archive = GeneratedFleetArchive.objects.create(
requested_by=request.user,
@@ -3080,6 +3087,7 @@ def _request_monthly_archive_generation(*, request, archive_type):
stage='requested',
year=year,
month=month,
generated_archive=generated_archive,
)
try: