diff options
Diffstat (limited to 'synapse')
-rwxr-xr-x | synapse/app/homeserver.py | 22 | ||||
-rwxr-xr-x | synapse/app/synctl.py | 19 | ||||
-rw-r--r-- | synapse/config/_base.py | 2 | ||||
-rw-r--r-- | synapse/python_dependencies.py | 7 |
4 files changed, 33 insertions, 17 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index d8d0df7e41..c227265190 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -496,11 +496,31 @@ class SynapseSite(Site): def run(hs): + PROFILE_SYNAPSE = False + if PROFILE_SYNAPSE: + def profile(func): + from cProfile import Profile + from threading import current_thread + + def profiled(*args, **kargs): + profile = Profile() + profile.enable() + func(*args, **kargs) + profile.disable() + ident = current_thread().ident + profile.dump_stats("/tmp/%s.%s.%i.pstat" % ( + hs.hostname, func.__name__, ident + )) + + return profiled + + from twisted.python.threadpool import ThreadPool + ThreadPool._worker = profile(ThreadPool._worker) + reactor.run = profile(reactor.run) def in_thread(): with LoggingContext("run"): change_resource_limit(hs.config.soft_file_limit) - reactor.run() if hs.config.daemonize: diff --git a/synapse/app/synctl.py b/synapse/app/synctl.py index 0a2b0d6fcd..1f7d543c31 100755 --- a/synapse/app/synctl.py +++ b/synapse/app/synctl.py @@ -27,20 +27,21 @@ CONFIGFILE = "homeserver.yaml" GREEN = "\x1b[1;32m" NORMAL = "\x1b[m" +if not os.path.exists(CONFIGFILE): + sys.stderr.write( + "No config file found\n" + "To generate a config file, run '%s -c %s --generate-config" + " --server-name=<server name>'\n" % ( + " ".join(SYNAPSE), CONFIGFILE + ) + ) + sys.exit(1) + CONFIG = yaml.load(open(CONFIGFILE)) PIDFILE = CONFIG["pid_file"] def start(): - if not os.path.exists(CONFIGFILE): - sys.stderr.write( - "No config file found\n" - "To generate a config file, run '%s -c %s --generate-config" - " --server-name=<server name>'\n" % ( - " ".join(SYNAPSE), CONFIGFILE - ) - ) - sys.exit(1) print "Starting ...", args = SYNAPSE args.extend(["--daemonize", "-c", CONFIGFILE]) diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 2807abbc90..d4163d6272 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -157,7 +157,7 @@ class Config(object): server_name = config_args.server_name if not server_name: - print "Most specify a server_name to a generate config for." + print "Must specify a server_name to a generate config for." sys.exit(1) (config_path,) = config_args.config_path if not os.path.exists(config_dir_path): diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index b1baad81c4..a45dd3c93d 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -24,7 +24,7 @@ REQUIREMENTS = { "pyopenssl>=0.14": ["OpenSSL>=0.14"], "pyyaml": ["yaml"], "pyasn1": ["pyasn1"], - "pynacl": ["nacl"], + "pynacl>=0.0.3": ["nacl>=0.0.3"], "daemonize": ["daemonize"], "py-bcrypt": ["bcrypt"], "frozendict>=0.4": ["frozendict"], @@ -51,11 +51,6 @@ def github_link(project, version, egg): DEPENDENCY_LINKS = [ github_link( - project="pyca/pynacl", - version="d4d3175589b892f6ea7c22f466e0e223853516fa", - egg="pynacl-0.3.0", - ), - github_link( project="matrix-org/syutil", version="v0.0.6", egg="syutil-0.0.6", |