diff options
author | Erik Johnston <erikj@element.io> | 2024-03-28 15:44:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-28 15:44:07 +0000 |
commit | ea6bfae0fca5303bcf2e474694d6a388ef3b6a90 (patch) | |
tree | 3e276ad9730b0af63de01925e96b5fade9d13d00 /synapse/rest | |
parent | Fixup changelog (diff) | |
download | synapse-ea6bfae0fca5303bcf2e474694d6a388ef3b6a90.tar.xz |
Add support for moving `/push_rules` off of main process (#17037)
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/client/push_rule.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/rest/client/push_rule.py b/synapse/rest/client/push_rule.py index 7d58611abb..9c9bfc9794 100644 --- a/synapse/rest/client/push_rule.py +++ b/synapse/rest/client/push_rule.py @@ -59,12 +59,12 @@ class PushRuleRestServlet(RestServlet): self.auth = hs.get_auth() self.store = hs.get_datastores().main self.notifier = hs.get_notifier() - self._is_worker = hs.config.worker.worker_app is not None + self._is_push_worker = hs.get_instance_name() in hs.config.worker.writers.push self._push_rules_handler = hs.get_push_rules_handler() self._push_rule_linearizer = Linearizer(name="push_rules") async def on_PUT(self, request: SynapseRequest, path: str) -> Tuple[int, JsonDict]: - if self._is_worker: + if not self._is_push_worker: raise Exception("Cannot handle PUT /push_rules on worker") requester = await self.auth.get_user_by_req(request) @@ -137,7 +137,7 @@ class PushRuleRestServlet(RestServlet): async def on_DELETE( self, request: SynapseRequest, path: str ) -> Tuple[int, JsonDict]: - if self._is_worker: + if not self._is_push_worker: raise Exception("Cannot handle DELETE /push_rules on worker") requester = await self.auth.get_user_by_req(request) |