From ddcecb21c43060624fb0f324d203b8e8a0cd5f8c Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Fri, 10 Feb 2023 09:18:04 -0500 Subject: [PATCH] Save logs in finally (#134) --- .../services/process_instance_processor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 549d7f39..f30ebd4b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -1582,17 +1582,17 @@ class ProcessInstanceProcessor: self.process_bpmn_messages() self.queue_waiting_receive_messages() + except SpiffWorkflowException as swe: + raise ApiError.from_workflow_exception("task_error", str(swe), swe) from swe + finally: db.session.bulk_insert_mappings(SpiffStepDetailsModel, step_details) spiff_logger = logging.getLogger("spiff") for handler in spiff_logger.handlers: if hasattr(handler, "bulk_insert_logs"): handler.bulk_insert_logs() # type: ignore db.session.commit() - except SpiffWorkflowException as swe: - raise ApiError.from_workflow_exception("task_error", str(swe), swe) from swe - finally: if save: self.save()