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

Fix redis password support. #7401

Merged
merged 3 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions changelog.d/7401.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for running replication over Redis when using workers.
3 changes: 3 additions & 0 deletions stubs/txredisapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class RedisProtocol:
def publish(self, channel: str, message: bytes): ...

class SubscriberProtocol:
password: Optional[str]
def subscribe(self, channels: Union[str, List[str]]): ...
def connectionMade(self): ...
def connectionLost(self, reason): ...

def lazyConnection(
host: str = ...,
Expand Down
3 changes: 3 additions & 0 deletions synapse/replication/tcp/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class RedisSubscriber(txredisapi.SubscriberProtocol, AbstractConnection):
outbound_redis_connection = None # type: txredisapi.RedisProtocol

def connectionMade(self):
super().connectionMade()
logger.info("Connected to redis instance")
self.subscribe(self.stream_name)
self.send_command(ReplicateCommand())
Expand Down Expand Up @@ -119,6 +120,7 @@ async def handle_command(self, cmd: Command):
logger.warning("Unhandled command: %r", cmd)

def connectionLost(self, reason):
super().connectionLost(reason)
logger.info("Lost connection to redis instance")
self.handler.lost_connection(self)

Expand Down Expand Up @@ -189,5 +191,6 @@ def buildProtocol(self, addr):
p.handler = self.handler
p.outbound_redis_connection = self.outbound_redis_connection
p.stream_name = self.stream_name
p.password = self.password

return p