commit the db at the end of the save method in the processor to avoid race conditions between process instance and human task w/ burnettk (#1158)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
a71af6e40f
commit
4cebddb6c2
|
@ -1072,7 +1072,6 @@ class ProcessInstanceProcessor:
|
||||||
self._workflow_completed_handler(self.process_instance_model)
|
self._workflow_completed_handler(self.process_instance_model)
|
||||||
|
|
||||||
db.session.add(self.process_instance_model)
|
db.session.add(self.process_instance_model)
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
human_tasks = HumanTaskModel.query.filter_by(process_instance_id=self.process_instance_model.id, completed=False).all()
|
human_tasks = HumanTaskModel.query.filter_by(process_instance_id=self.process_instance_model.id, completed=False).all()
|
||||||
ready_or_waiting_tasks = self.get_all_ready_or_waiting_tasks()
|
ready_or_waiting_tasks = self.get_all_ready_or_waiting_tasks()
|
||||||
|
@ -1136,13 +1135,11 @@ class ProcessInstanceProcessor:
|
||||||
human_task_user = HumanTaskUserModel(user_id=potential_owner_id, human_task=human_task)
|
human_task_user = HumanTaskUserModel(user_id=potential_owner_id, human_task=human_task)
|
||||||
db.session.add(human_task_user)
|
db.session.add(human_task_user)
|
||||||
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
if len(human_tasks) > 0:
|
if len(human_tasks) > 0:
|
||||||
for at in human_tasks:
|
for at in human_tasks:
|
||||||
at.completed = True
|
at.completed = True
|
||||||
db.session.add(at)
|
db.session.add(at)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
def serialize_task_spec(self, task_spec: SpiffTask) -> dict:
|
def serialize_task_spec(self, task_spec: SpiffTask) -> dict:
|
||||||
"""Get a serialized version of a task spec."""
|
"""Get a serialized version of a task spec."""
|
||||||
|
|
Loading…
Reference in New Issue