always save the serialized bpmn definition for now w/ burnettk

This commit is contained in:
jasquat 2023-03-01 15:01:29 -05:00
parent d1b8de9ea3
commit 53486823b6
1 changed files with 20 additions and 12 deletions

View File

@ -874,18 +874,24 @@ class ProcessInstanceProcessor:
else: else:
process_instance_data_dict[bpmn_key] = bpmn_dict[bpmn_key] process_instance_data_dict[bpmn_key] = bpmn_dict[bpmn_key]
if self.process_instance_model.serialized_bpmn_definition_id is None: # FIXME: always save new hash until we get updated Spiff without loopresettask
new_hash_digest = sha256( # if self.process_instance_model.serialized_bpmn_definition_id is None:
json.dumps(bpmn_spec_dict, sort_keys=True).encode("utf8") new_hash_digest = sha256(
).hexdigest() json.dumps(bpmn_spec_dict, sort_keys=True).encode("utf8")
serialized_bpmn_definition = SerializedBpmnDefinitionModel.query.filter_by( ).hexdigest()
hash=new_hash_digest serialized_bpmn_definition = SerializedBpmnDefinitionModel.query.filter_by(
).first() hash=new_hash_digest
if serialized_bpmn_definition is None: ).first()
serialized_bpmn_definition = SerializedBpmnDefinitionModel( if serialized_bpmn_definition is None:
hash=new_hash_digest, static_json=json.dumps(bpmn_spec_dict) serialized_bpmn_definition = SerializedBpmnDefinitionModel(
) hash=new_hash_digest, static_json=json.dumps(bpmn_spec_dict)
db.session.add(serialized_bpmn_definition) )
db.session.add(serialized_bpmn_definition)
if (
self.process_instance_model.serialized_bpmn_definition_id is None
or self.process_instance_model.serialized_bpmn_definition.hash
!= new_hash_digest
):
self.process_instance_model.serialized_bpmn_definition = ( self.process_instance_model.serialized_bpmn_definition = (
serialized_bpmn_definition serialized_bpmn_definition
) )
@ -1299,6 +1305,8 @@ class ProcessInstanceProcessor:
return ProcessInstanceStatus.complete return ProcessInstanceStatus.complete
user_tasks = bpmn_process_instance.get_ready_user_tasks() user_tasks = bpmn_process_instance.get_ready_user_tasks()
# workflow.waiting_events (includes timers, and timers have a when firing property)
# if the process instance has status "waiting" it will get picked up # if the process instance has status "waiting" it will get picked up
# by background processing. when that happens it can potentially overwrite # by background processing. when that happens it can potentially overwrite
# human tasks which is bad because we cache them with the previous id's. # human tasks which is bad because we cache them with the previous id's.