summary refs log tree commit diff
path: root/synapse/replication/tcp/handler.py
diff options
context:
space:
mode:
authorJason Little <realtyem@gmail.com>2023-05-26 14:28:39 -0500
committerGitHub <noreply@github.com>2023-05-26 15:28:39 -0400
commitc835befd10ae0087c3c54a36989ba347313b68af (patch)
treeed898f1379a6e93a0351aad64023a9b073f7a48a /synapse/replication/tcp/handler.py
parentAdd `MSC3820opt2` as a known room version (#15678) (diff)
downloadsynapse-c835befd10ae0087c3c54a36989ba347313b68af.tar.xz
Add Unix socket support for Redis connections (#15644)
Adds a new configuration setting to connect to Redis via a Unix
socket instead of over TCP. Disabled by default.
Diffstat (limited to 'synapse/replication/tcp/handler.py')
-rw-r--r--synapse/replication/tcp/handler.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/replication/tcp/handler.py b/synapse/replication/tcp/handler.py
index 233ad61d49..5d108fe11b 100644
--- a/synapse/replication/tcp/handler.py
+++ b/synapse/replication/tcp/handler.py
@@ -352,7 +352,15 @@ class ReplicationCommandHandler:
 
         reactor = hs.get_reactor()
         redis_config = hs.config.redis
-        if hs.config.redis.redis_use_tls:
+        if redis_config.redis_path is not None:
+            reactor.connectUNIX(
+                redis_config.redis_path,
+                self._factory,
+                timeout=30,
+                checkPID=False,
+            )
+
+        elif hs.config.redis.redis_use_tls:
             ssl_context_factory = ClientContextFactory(hs.config.redis)
             reactor.connectSSL(
                 redis_config.redis_host,