summary refs log tree commit diff
path: root/synapse/replication/tcp/handler.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-01-07 20:19:26 +0000
committerGitHub <noreply@github.com>2021-01-07 20:19:26 +0000
commitb530eaa262b9c8af378f976e5d2628e8c02b10d8 (patch)
tree0ef6713632c385060feb27328bcbc790be84dd18 /synapse/replication/tcp/handler.py
parentSupport routing edu's to multiple instances (#9042) (diff)
downloadsynapse-b530eaa262b9c8af378f976e5d2628e8c02b10d8.tar.xz
Allow running sendToDevice on workers (#9044)
Diffstat (limited to 'synapse/replication/tcp/handler.py')
-rw-r--r--synapse/replication/tcp/handler.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/replication/tcp/handler.py b/synapse/replication/tcp/handler.py
index 95e5502bf2..1f89249475 100644
--- a/synapse/replication/tcp/handler.py
+++ b/synapse/replication/tcp/handler.py
@@ -56,6 +56,7 @@ from synapse.replication.tcp.streams import (
     EventsStream,
     FederationStream,
     Stream,
+    ToDeviceStream,
     TypingStream,
 )
 
@@ -115,6 +116,14 @@ class ReplicationCommandHandler:
 
                 continue
 
+            if isinstance(stream, ToDeviceStream):
+                # Only add ToDeviceStream as a source on instances in charge of
+                # sending to device messages.
+                if hs.get_instance_name() in hs.config.worker.writers.to_device:
+                    self._streams_to_replicate.append(stream)
+
+                continue
+
             if isinstance(stream, TypingStream):
                 # Only add TypingStream as a source on the instance in charge of
                 # typing.