Skip to content

Commit bd7d542

Browse files
committed
fix: Adjust to Synapse utilities that use Metrics and now require a 'server_name'
1 parent 7c7c0d5 commit bd7d542

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

synapse_invite_checker/invite_checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def __init__(
186186

187187
mstls_policy = MtlsPolicy(config)
188188
proxy_agent = ProxyAgent(
189-
self.reactor,
190-
hs.get_reactor(),
189+
reactor=self.reactor,
190+
proxy_reactor=hs.get_reactor(),
191191
connectTimeout=15,
192192
contextFactory=cast(IPolicyForHTTPS, mstls_policy),
193193
pool=pool,

tests/server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def make_request(
386386

387387
channel = FakeChannel(site, reactor, ip=client_ip) # type: ignore[call-arg]
388388

389-
req = request(channel, site)
389+
req = request(channel, site, our_server_name="test_server")
390390
channel.request = req
391391

392392
req.content = BytesIO(content) # type: ignore[assignment]
@@ -659,6 +659,7 @@ def make_fake_db_pool(
659659
reactor: ISynapseReactor,
660660
db_config: DatabaseConnectionConfig,
661661
engine: BaseDatabaseEngine,
662+
server_name: str,
662663
) -> adbapi.ConnectionPool:
663664
"""Wrapper for `make_pool` which builds a pool which runs db queries synchronously.
664665
@@ -667,7 +668,9 @@ def make_fake_db_pool(
667668
is a drop-in replacement for the normal `make_pool` which builds such a connection
668669
pool.
669670
"""
670-
pool = make_pool(reactor, db_config, engine)
671+
pool = make_pool(
672+
reactor=reactor, db_config=db_config, engine=engine, server_name=server_name
673+
)
671674

672675
def runWithConnection(
673676
func: Callable[..., R], *args: Any, **kwargs: Any

tests/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ def setupdb() -> None:
8585
port=POSTGRES_PORT,
8686
password=POSTGRES_PASSWORD,
8787
)
88-
logging_conn = LoggingDatabaseConnection(db_conn, db_engine, "tests")
88+
logging_conn = LoggingDatabaseConnection(
89+
conn=db_conn,
90+
engine=db_engine,
91+
default_txn_name="tests",
92+
server_name="test_server",
93+
)
8994
prepare_database(logging_conn, db_engine, None)
9095
logging_conn.close()
9196

0 commit comments

Comments
 (0)