You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/03/21 14:33:33 UTC

[allura] 01/01: remove sql-only twophase_transaction helper

This is an automated email from the ASF dual-hosted git repository.

dill0wn pushed a commit to branch dw/cleanup-sql-helper
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 85ff9857f5b9d69b906b637c437318b76816a2ed
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Mon Mar 21 14:33:28 2022 +0000

    remove sql-only twophase_transaction helper
---
 Allura/allura/lib/helpers.py | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 0e280b1..f0d0025 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -670,31 +670,6 @@ def config_with_prefix(d, prefix):
                 if k.startswith(prefix)}
 
 
-@contextmanager
-def twophase_transaction(*engines):
-    connections = [
-        e.contextual_connect()
-        for e in engines]
-    txns = []
-    to_rollback = []
-    try:
-        for conn in connections:
-            txn = conn.begin_twophase()
-            txns.append(txn)
-            to_rollback.append(txn)
-        yield
-        to_rollback = []
-        for txn in txns:
-            txn.prepare()
-            to_rollback.append(txn)
-        for txn in txns:
-            txn.commit()
-    except Exception:
-        for txn in to_rollback:
-            txn.rollback()
-        raise
-
-
 def paging_sanitizer(limit, page, total_count=sys.maxsize, zero_based_pages=True):
     """Return limit, page - both converted to int and constrained to
     valid ranges based on total_count.