mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Fix unhandled not found error when manually managing sync jobs (#5412)
* Fix unhandled not found error when manually managing sync jobs * Improve info text (suggestions from code review) Co-authored-by: luelista <weller@rami.io> --------- Co-authored-by: luelista <weller@rami.io>
This commit is contained in:
committed by
GitHub
parent
24ac588119
commit
09e9273a57
@@ -82,9 +82,13 @@ class ControlSyncJob(OrderView):
|
|||||||
messages.success(self.request, _('The sync job has been enqueued and will run in the next minutes.'))
|
messages.success(self.request, _('The sync job has been enqueued and will run in the next minutes.'))
|
||||||
elif self.request.POST.get("cancel_job"):
|
elif self.request.POST.get("cancel_job"):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
try:
|
||||||
job = self.order.queued_sync_jobs.select_for_update(of=OF_SELF).get(
|
job = self.order.queued_sync_jobs.select_for_update(of=OF_SELF).get(
|
||||||
pk=self.request.POST.get("cancel_job")
|
pk=self.request.POST.get("cancel_job")
|
||||||
)
|
)
|
||||||
|
except OrderSyncQueue.DoesNotExist:
|
||||||
|
messages.info(self.request, _('The sync job could not be found. It may have been processed in the meantime.'))
|
||||||
|
else:
|
||||||
if job.in_flight:
|
if job.in_flight:
|
||||||
messages.warning(self.request, _('The sync job is already in progress.'))
|
messages.warning(self.request, _('The sync job is already in progress.'))
|
||||||
else:
|
else:
|
||||||
@@ -92,9 +96,13 @@ class ControlSyncJob(OrderView):
|
|||||||
messages.success(self.request, _('The sync job has been canceled.'))
|
messages.success(self.request, _('The sync job has been canceled.'))
|
||||||
elif self.request.POST.get("run_job_now"):
|
elif self.request.POST.get("run_job_now"):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
try:
|
||||||
job = self.order.queued_sync_jobs.select_for_update(of=OF_SELF).get(
|
job = self.order.queued_sync_jobs.select_for_update(of=OF_SELF).get(
|
||||||
pk=self.request.POST.get("run_job_now")
|
pk=self.request.POST.get("run_job_now")
|
||||||
)
|
)
|
||||||
|
except OrderSyncQueue.DoesNotExist:
|
||||||
|
messages.info(self.request, _('The sync job could not be found. It may have been processed in the meantime.'))
|
||||||
|
else:
|
||||||
if job.in_flight:
|
if job.in_flight:
|
||||||
messages.success(self.request, _('The sync job is already in progress.'))
|
messages.success(self.request, _('The sync job is already in progress.'))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user