summary refs log tree commit diff
path: root/synapse/replication/http/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-05-22 16:11:35 +0100
committerGitHub <noreply@github.com>2020-05-22 16:11:35 +0100
commite5c67d04dbe5ed45d659e826a5dfcd5044a4e374 (patch)
tree0ee1f865349d9fb3a6b215001f3c7ac3b7c0552b /synapse/replication/http/_base.py
parentReturn 200 OK for all OPTIONS requests (#7534) (diff)
downloadsynapse-e5c67d04dbe5ed45d659e826a5dfcd5044a4e374.tar.xz
Add option to move event persistence off master (#7517)
Diffstat (limited to 'synapse/replication/http/_base.py')
-rw-r--r--synapse/replication/http/_base.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/replication/http/_base.py b/synapse/replication/http/_base.py
index c3136a4eb9..793cef6c26 100644
--- a/synapse/replication/http/_base.py
+++ b/synapse/replication/http/_base.py
@@ -142,6 +142,7 @@ class ReplicationEndpoint(object):
         """
         clock = hs.get_clock()
         client = hs.get_simple_http_client()
+        local_instance_name = hs.get_instance_name()
 
         master_host = hs.config.worker_replication_host
         master_port = hs.config.worker_replication_http_port
@@ -151,6 +152,8 @@ class ReplicationEndpoint(object):
         @trace(opname="outgoing_replication_request")
         @defer.inlineCallbacks
         def send_request(instance_name="master", **kwargs):
+            if instance_name == local_instance_name:
+                raise Exception("Trying to send HTTP request to self")
             if instance_name == "master":
                 host = master_host
                 port = master_port