From 8772f26b911cbc605aa598587ee90b05b23f95b2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 20 May 2021 20:35:12 -0700 Subject: [PATCH] Don't error when task for import no longer exists --- bookwyrm/views/import_data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/views/import_data.py b/bookwyrm/views/import_data.py index 910283c4..62dcce73 100644 --- a/bookwyrm/views/import_data.py +++ b/bookwyrm/views/import_data.py @@ -81,7 +81,10 @@ class ImportStatus(View): job = models.ImportJob.objects.get(id=job_id) if job.user != request.user: raise PermissionDenied - task = app.AsyncResult(job.task_id) + try: + task = app.AsyncResult(job.task_id) + except ValueError: + task = None items = job.items.order_by("index").all() failed_items = [i for i in items if i.fail_reason] items = [i for i in items if not i.fail_reason]