summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-rwxr-xr-xsynapse/app/homeserver.py8
-rw-r--r--synapse/config/server.py10
2 files changed, 11 insertions, 7 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 5f671dfd23..89af091f10 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -273,7 +273,12 @@ def get_version_string():
 def change_resource_limit(soft_file_no):
     try:
         soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
+
+        if not soft_file_no:
+            soft_file_no = hard
+
         resource.setrlimit(resource.RLIMIT_NOFILE, (soft_file_no, hard))
+
         logger.info("Set file limit to: %d", soft_file_no)
     except (ValueError, resource.error) as e:
         logger.warn("Failed to set file limit: %s", e)
@@ -372,8 +377,7 @@ def setup():
 
 def run(config):
     with LoggingContext("run"):
-        if config.soft_file_limit:
-            change_resource_limit(config.soft_file_limit)
+        change_resource_limit(config.soft_file_limit)
 
         reactor.run()
 
diff --git a/synapse/config/server.py b/synapse/config/server.py
index a3edf208e9..4e4892d40b 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -79,11 +79,11 @@ class ServerConfig(Config):
         server_group.add_argument("--no-tls", action='store_true',
                                   help="Don't bind to the https port.")
         server_group.add_argument("--soft-file-limit", type=int, default=0,
-                                  help="Set the limit on the number of file "
-                                       "descriptors synapse can use. Zero "
-                                       "is used to indicate synapse should "
-                                       "not change the limit from system "
-                                       "default.")
+                                  help="Set the soft limit on the number of "
+                                       "file descriptors synapse can use. "
+                                       "Zero is used to indicate synapse "
+                                       "should set the soft limit to the hard"
+                                       "limit.")
 
     def read_signing_key(self, signing_key_path):
         signing_keys = self.read_file(signing_key_path, "signing_key")