summary refs log tree commit diff
path: root/synapse/config
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/config
parentSupport routing edu's to multiple instances (#9042) (diff)
downloadsynapse-b530eaa262b9c8af378f976e5d2628e8c02b10d8.tar.xz
Allow running sendToDevice on workers (#9044)
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/workers.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/config/workers.py b/synapse/config/workers.py
index 7ca9efec52..364583f48b 100644
--- a/synapse/config/workers.py
+++ b/synapse/config/workers.py
@@ -53,6 +53,9 @@ class WriterLocations:
         default=["master"], type=List[str], converter=_instance_to_list_converter
     )
     typing = attr.ib(default="master", type=str)
+    to_device = attr.ib(
+        default=["master"], type=List[str], converter=_instance_to_list_converter,
+    )
 
 
 class WorkerConfig(Config):
@@ -124,7 +127,7 @@ class WorkerConfig(Config):
 
         # Check that the configured writers for events and typing also appears in
         # `instance_map`.
-        for stream in ("events", "typing"):
+        for stream in ("events", "typing", "to_device"):
             instances = _instance_to_list_converter(getattr(self.writers, stream))
             for instance in instances:
                 if instance != "master" and instance not in self.instance_map:
@@ -133,6 +136,11 @@ class WorkerConfig(Config):
                         % (instance, stream)
                     )
 
+        if len(self.writers.to_device) != 1:
+            raise ConfigError(
+                "Must only specify one instance to handle `to_device` messages."
+            )
+
         self.events_shard_config = ShardedWorkerHandlingConfig(self.writers.events)
 
         # Whether this worker should run background tasks or not.