19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:27 +01:00
parent d1963a3c3a
commit 2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions

View file

@ -175,9 +175,16 @@ class BaseCursor(_CursorProtocol):
def flush(self) -> None:
""" Flush the current transaction, and run precommit hooks. """
if self.transaction is not None:
self.transaction.flush()
self.precommit.run()
# In case some pre-commit added another pre-commit or triggered changes
# in the ORM, we must flush and run it again.
for _ in range(10): # limit number of iterations
if self.transaction is not None:
self.transaction.flush()
if not self.precommit:
break
self.precommit.run()
else:
_logger.warning("Too many iterations for flushing the cursor!")
def clear(self) -> None:
""" Clear the current transaction, and clear precommit hooks. """
@ -793,7 +800,7 @@ def connection_info_for(db_or_uri: str, readonly=False) -> tuple[str, dict]:
for p in ('host', 'port', 'user', 'password', 'sslmode'):
cfg = tools.config['db_' + p]
if readonly:
cfg = tools.config.get('db_replica_' + p, cfg)
cfg = tools.config.get('db_replica_' + p) or cfg
if cfg:
connection_info[p] = cfg