Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Fix remaining mypy issues due to Twisted upgrade. #9608

Merged
merged 7 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
The host is expected to be bytes.
  • Loading branch information
clokep committed Mar 15, 2021
commit 91fe968b62c050e975ae9655deb2fa3f9b0a0944
4 changes: 2 additions & 2 deletions synapse/replication/tcp/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def start_replication(self, hs):
hs, outbound_redis_connection
)
hs.get_reactor().connectTCP(
hs.config.redis.redis_host,
hs.config.redis.redis_host.encode(),
hs.config.redis.redis_port,
self._factory,
)
Expand All @@ -311,7 +311,7 @@ def start_replication(self, hs):
self._factory = DirectTcpReplicationClientFactory(hs, client_name, self)
host = hs.config.worker_replication_host
port = hs.config.worker_replication_port
hs.get_reactor().connectTCP(host, port, self._factory)
hs.get_reactor().connectTCP(host.encode(), port, self._factory)

def get_streams(self) -> Dict[str, Stream]:
"""Get a map from stream name to all streams."""
Expand Down
2 changes: 1 addition & 1 deletion synapse/replication/tcp/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,6 @@ def lazyConnection(
factory.continueTrying = reconnect

reactor = hs.get_reactor()
reactor.connectTCP(host, port, factory, timeout=30, bindAddress=None)
reactor.connectTCP(host.encode(), port, factory, timeout=30, bindAddress=None)

return factory.handler
4 changes: 2 additions & 2 deletions tests/replication/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def setUp(self):
if self.hs.config.redis.redis_enabled:
# Handle attempts to connect to fake redis server.
self.reactor.add_tcp_client_callback(
"localhost",
b"localhost",
6379,
self.connect_any_redis_attempts,
)
Expand Down Expand Up @@ -415,7 +415,7 @@ def connect_any_redis_attempts(self):
clients = self.reactor.tcpClients
while clients:
(host, port, client_factory, _timeout, _bindAddress) = clients.pop(0)
self.assertEqual(host, "localhost")
self.assertEqual(host, b"localhost")
self.assertEqual(port, 6379)

client_protocol = client_factory.buildProtocol(None)
Expand Down