Don't reset the token to something that already has a token. Terrible things happen and we hit a recursion.

This commit is contained in:
Dan Funk 2020-05-17 13:29:36 -04:00
parent d62c173494
commit fc080ce7a8
1 changed files with 3 additions and 1 deletions

View File

@ -149,7 +149,9 @@ def set_current_task(workflow_id, task_id):
raise ApiError("invalid_state", "You may not move the token to a task who's state is not "
"currently set to COMPLETE or READY.")
task.reset_token(reset_data=False) # we could optionally clear the previous data.
# Only reset the token if the task doesn't already have it.
if task.state == task.COMPLETED:
task.reset_token(reset_data=False) # we could optionally clear the previous data.
processor.save()
WorkflowService.log_task_action(processor, task, WorkflowService.TASK_ACTION_TOKEN_RESET)
workflow_api_model = __get_workflow_api_model(processor, task)