summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-20 16:09:44 +0000
committerErik Johnston <erik@matrix.org>2015-02-20 16:09:44 +0000
commit7c56210f204ef735444129c4f7b2a393eb7539ec (patch)
treeb4d63cb8662fbb0ee67c2601566d470bd3a13a14 /synapse/app
parentRename resource variable so as to not shadow module import (diff)
downloadsynapse-7c56210f204ef735444129c4f7b2a393eb7539ec.tar.xz
By default set soft limit to hard limit
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py8
1 files changed, 6 insertions, 2 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()