From fefe33eb56cea998e7d5006b9e40355e207e1898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Tue, 18 Jun 2024 23:09:17 +0200 Subject: [PATCH] Remove outdated method from database --- src/api/database/database.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/api/database/database.py b/src/api/database/database.py index db4e8f4..18fbbec 100644 --- a/src/api/database/database.py +++ b/src/api/database/database.py @@ -715,31 +715,6 @@ class DbConnectionPool: pass self._on_connection_released(True, connection) - @contextmanager - def start_read_transaction(self) -> ReadTransaction: - """ - Starts a read-only transaction. - - May raise :class:`NoAvailableConnectionError` - """ - transaction = None - try: - if self._factory.supports_per_transaction_writeable_flag(): - connection = self._cache.get_connection() - else: - connection = self._read_cache.get_connection() - transaction = ReadTransaction(lambda: self._on_connection_released(False, connection), connection) - yield transaction - if not transaction.is_closed(): - print("Warning: Rolling open transaction back after execution but there was no exception (Always " - "close the transaction explicitly)") - transaction.close() - except Exception: - if transaction is not None and not transaction.is_closed(): - _COUNTERS_TRANSACTION_ABORTED_BY_USER["read"].trigger() - transaction.on_error_close_transaction() - raise - def execute_read_statement_in_transaction(self, statement: PreparedStatement or str, *values: DbValueType) -> DbResultSet: -- GitLab