summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-06-16 12:44:40 +0100
committerMark Haines <mark.haines@matrix.org>2016-06-16 12:44:40 +0100
commitbde13833cb42fc6e09928ffb4f4efad9244abffa (patch)
treed5e2194c45f07c7ab99affa1351fdcec61bd9622
parentComment on what's going on in clobber_with_worker_config (diff)
downloadsynapse-bde13833cb42fc6e09928ffb4f4efad9244abffa.tar.xz
Access replication_url from the worker config directly
-rw-r--r--synapse/app/pusher.py5
-rw-r--r--synapse/app/synchrotron.py5
-rw-r--r--synapse/config/workers.py4
3 files changed, 6 insertions, 8 deletions
diff --git a/synapse/app/pusher.py b/synapse/app/pusher.py
index 6c8c02fb38..a26a3bd394 100644
--- a/synapse/app/pusher.py
+++ b/synapse/app/pusher.py
@@ -112,7 +112,7 @@ class PusherServer(HomeServer):
 
     def remove_pusher(self, app_id, push_key, user_id):
         http_client = self.get_simple_http_client()
-        replication_url = self.config.replication_url
+        replication_url = self.worker_config.replication_url
         url = replication_url + "/remove_pushers"
         return http_client.post_json_get_json(url, {
             "remove": [{
@@ -166,7 +166,7 @@ class PusherServer(HomeServer):
     def replicate(self):
         http_client = self.get_simple_http_client()
         store = self.get_datastore()
-        replication_url = self.config.replication_url
+        replication_url = self.worker_config.replication_url
         pusher_pool = self.get_pusherpool()
         clock = self.get_clock()
 
@@ -275,6 +275,7 @@ def setup(worker_name, config_options):
         config.server_name,
         db_config=config.database_config,
         config=config,
+        worker_config=worker_config,
         version_string=get_version_string("Synapse", synapse),
         database_engine=database_engine,
     )
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py
index 7a607faef6..4443c73e6a 100644
--- a/synapse/app/synchrotron.py
+++ b/synapse/app/synchrotron.py
@@ -98,7 +98,7 @@ class SynchrotronPresence(object):
         self.http_client = hs.get_simple_http_client()
         self.store = hs.get_datastore()
         self.user_to_num_current_syncs = {}
-        self.syncing_users_url = hs.config.replication_url + "/syncing_users"
+        self.syncing_users_url = hs.worker_config.replication_url + "/syncing_users"
         self.clock = hs.get_clock()
 
         active_presence = self.store.take_presence_startup_info()
@@ -306,7 +306,7 @@ class SynchrotronServer(HomeServer):
     def replicate(self):
         http_client = self.get_simple_http_client()
         store = self.get_datastore()
-        replication_url = self.config.replication_url
+        replication_url = self.worker_config.replication_url
         clock = self.get_clock()
         notifier = self.get_notifier()
         presence_handler = self.get_presence_handler()
@@ -426,6 +426,7 @@ def start(worker_name, config_options):
         config.server_name,
         db_config=config.database_config,
         config=config,
+        worker_config=worker_config,
         version_string=get_version_string("Synapse", synapse),
         database_engine=database_engine,
         application_service_handler=SynchrotronApplicationService(),
diff --git a/synapse/config/workers.py b/synapse/config/workers.py
index 4f4658c0a8..f2c77ef59a 100644
--- a/synapse/config/workers.py
+++ b/synapse/config/workers.py
@@ -46,10 +46,6 @@ def clobber_with_worker_config(config, worker_config):
     # worker config directly.
     config.event_cache_size = worker_config.event_cache_size
 
-    # TODO: The replication_url should only be accessed within worker specific
-    # code so it really shouldn't need to be clobbered in the main config.
-    config.replication_url = worker_config.replication_url
-
 
 def read_worker_config(config):
     return Worker(