mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-05 09:02:13 +00:00
Fix bug where we reconnected to the database on every query.
This commit is contained in:
parent
23c639ff32
commit
fabb7acd45
@ -301,6 +301,7 @@ class SQLBaseStore(object):
|
|||||||
def inner_func(conn, *args, **kwargs):
|
def inner_func(conn, *args, **kwargs):
|
||||||
with LoggingContext("runInteraction") as context:
|
with LoggingContext("runInteraction") as context:
|
||||||
if self.database_engine.is_connection_closed(conn):
|
if self.database_engine.is_connection_closed(conn):
|
||||||
|
logger.debug("Reconnecting closed database connection")
|
||||||
conn.reconnect()
|
conn.reconnect()
|
||||||
|
|
||||||
current_context.copy_to(context)
|
current_context.copy_to(context)
|
||||||
|
@ -53,7 +53,7 @@ class PostgresEngine(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def is_connection_closed(self, conn):
|
def is_connection_closed(self, conn):
|
||||||
return bool(conn)
|
return bool(conn.closed)
|
||||||
|
|
||||||
def lock_table(self, txn, table):
|
def lock_table(self, txn, table):
|
||||||
txn.execute("LOCK TABLE %s in EXCLUSIVE MODE" % (table,))
|
txn.execute("LOCK TABLE %s in EXCLUSIVE MODE" % (table,))
|
||||||
|
Loading…
Reference in New Issue
Block a user