predzadnji unstagaeni dijelovi
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user