summary refs log tree commit diff
path: root/synapse/app/pusher.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/app/pusher.py')
-rw-r--r--synapse/app/pusher.py29
1 files changed, 12 insertions, 17 deletions
diff --git a/synapse/app/pusher.py b/synapse/app/pusher.py
index 5d4db4f892..9ac26d52c6 100644
--- a/synapse/app/pusher.py
+++ b/synapse/app/pusher.py
@@ -111,7 +111,7 @@ class PusherServer(HomeServer):
 
     def remove_pusher(self, app_id, push_key, user_id):
         http_client = self.get_simple_http_client()
-        replication_url = self.worker_config.replication_url
+        replication_url = self.config.worker_replication_url
         url = replication_url + "/remove_pushers"
         return http_client.post_json_get_json(url, {
             "remove": [{
@@ -165,7 +165,7 @@ class PusherServer(HomeServer):
     def replicate(self):
         http_client = self.get_simple_http_client()
         store = self.get_datastore()
-        replication_url = self.worker_config.replication_url
+        replication_url = self.config.worker_replication_url
         pusher_pool = self.get_pusherpool()
         clock = self.get_clock()
 
@@ -240,11 +240,8 @@ class PusherServer(HomeServer):
                 logger.exception("Error replicating from %r", replication_url)
                 yield sleep(30)
 
-    def get_event_cache_size(self):
-        return self.worker_config.event_cache_size
 
-
-def setup(worker_name, config_options):
+def start(config_options):
     try:
         config = HomeServerConfig.load_config(
             "Synapse pusher", config_options
@@ -253,9 +250,9 @@ def setup(worker_name, config_options):
         sys.stderr.write("\n" + e.message + "\n")
         sys.exit(1)
 
-    worker_config = config.workers[worker_name]
+    assert config.worker_app == "synapse.app.pusher"
 
-    setup_logging(worker_config.log_config, worker_config.log_file)
+    setup_logging(config.worker_log_config, config.worker_log_file)
 
     if config.start_pushers:
         sys.stderr.write(
@@ -275,20 +272,19 @@ 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,
     )
 
     ps.setup()
-    ps.start_listening(worker_config.listeners)
+    ps.start_listening(config.worker_listeners)
 
     def run():
         with LoggingContext("run"):
             logger.info("Running")
-            change_resource_limit(worker_config.soft_file_limit)
-            if worker_config.gc_thresholds:
-                ps.set_threshold(worker_config.gc_thresholds)
+            change_resource_limit(config.soft_file_limit)
+            if config.gc_thresholds:
+                ps.set_threshold(config.gc_thresholds)
             reactor.run()
 
     def start():
@@ -298,10 +294,10 @@ def setup(worker_name, config_options):
 
     reactor.callWhenRunning(start)
 
-    if worker_config.daemonize:
+    if config.worker_daemonize:
         daemon = Daemonize(
             app="synapse-pusher",
-            pid=worker_config.pid_file,
+            pid=config.worker_pid_file,
             action=run,
             auto_close_fds=False,
             verbose=True,
@@ -314,5 +310,4 @@ def setup(worker_name, config_options):
 
 if __name__ == '__main__':
     with LoggingContext("main"):
-        worker_name = sys.argv[1]
-        ps = setup(worker_name, sys.argv[2:])
+        ps = start(sys.argv[1:])