Skip to content

Commit 3583e8e

Browse files
committed
Use transaction instead of session begin
1 parent c45c20e commit 3583e8e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/galaxy/managers/histories.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,11 @@ def archive_history(self, history: model.History, archive_export_id: Optional[in
373373
374374
**Important**: The caller is responsible for passing a valid `archive_export_id` that belongs to the given history.
375375
"""
376-
with self.session().begin():
377-
history.archived = True
378-
history.archive_export_id = archive_export_id
376+
history.archived = True
377+
history.archive_export_id = archive_export_id
378+
with transaction(self.session()):
379+
self.session().commit()
380+
379381
return history
380382

381383
def restore_archived_history(self, history: model.History, force: bool = False):
@@ -394,8 +396,11 @@ def restore_archived_history(self, history: model.History, force: bool = False):
394396
"Please try importing it back as a new copy from the associated archive export record instead. "
395397
"You can still force the un-archiving of the purged history by setting the 'force' parameter."
396398
)
397-
with self.session().begin():
398-
history.archived = False
399+
400+
history.archived = False
401+
with transaction(self.session()):
402+
self.session().commit()
403+
399404
return history
400405

401406

0 commit comments

Comments
 (0)