From 7cf5734807966e1070620cb14543c444e7736ce2 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 12 Oct 2013 22:22:26 -0700 Subject: [PATCH] Save with the same connection Instead of 2 different connections, one for saving the flow detail and then one for saving the task detail just use one connection for both. Change-Id: I68315a6c201325bb154f5ab5fc69a3824055c912 --- taskflow/storage.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/taskflow/storage.py b/taskflow/storage.py index e7d3d871..1db3917a 100644 --- a/taskflow/storage.py +++ b/taskflow/storage.py @@ -80,8 +80,13 @@ class Storage(object): td.state = states.PENDING td.version = task_version self._flowdetail.add(td) - self._with_connection(self._save_flow_detail) - self._with_connection(self._save_task_detail, task_detail=td) + + def save_both(conn): + """Saves the flow and the task detail with the same connection""" + self._save_flow_detail(conn) + self._save_task_detail(conn, task_detail=td) + + self._with_connection(save_both) def _save_flow_detail(self, conn): # NOTE(harlowja): we need to update our contained flow detail if