Skip to content

Commit

Permalink
Ignore the arg-type for the Cursor passed into set_statement_timeout(…
Browse files Browse the repository at this point in the history
…) for the moment

See comment in commit. This will need bigger surgery
  • Loading branch information
realtyem committed Oct 13, 2024
1 parent c14be83 commit 22652eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion synapse/storage/engines/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ def on_new_connection(self, db_conn: "LoggingDatabaseConnection") -> None:

# Abort really long-running statements and turn them into errors.
if self.statement_timeout is not None:
self.set_statement_timeout(cursor.txn, self.statement_timeout)
# Because the PostgresEngine is considered an ABCMeta, a superclass and a
# subclass, cursor's type is messy. We know it should be a CursorType,
# but for now that doesn't pass cleanly through LoggingDatabaseConnection
# and LoggingTransaction. Fortunately, it's merely running an execute()
# and nothing more exotic.
self.set_statement_timeout(cursor.txn, self.statement_timeout) # type: ignore[arg-type]

cursor.close()
db_conn.commit()
Expand Down

0 comments on commit 22652eb

Please sign in to comment.