Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#725 | recieved task should update state fro…
Browse files Browse the repository at this point in the history
…m celery async result if needed
  • Loading branch information
snyaggarwal committed May 2, 2021
1 parent 151fa20 commit 5551a36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/importers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ def get(
if (not import_queue or task['queue'] == import_queue) and \
(not username or task['username'] == username):
details = dict(task=task_id, state=value['state'], queue=task['queue'], username=task['username'])
if value['state'] in ['RECEIVED', 'PENDING']:
result = AsyncResult(task_id)
if result.state and result.state != value['state']:
details['state'] = result.state
if is_verbose:
details['details'] = value
tasks.append(details)
Expand Down

0 comments on commit 5551a36

Please sign in to comment.