0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-21 08:44:00 +01:00

Merge branch 'hotfixes-v0.9.0-r2' of github.com:matrix-org/synapse

This commit is contained in:
Erik Johnston 2015-05-08 16:13:15 +01:00
commit 37feb4031f
7 changed files with 67 additions and 19 deletions

View file

@ -16,4 +16,4 @@
""" This is a reference implementation of a Matrix home server.
"""
__version__ = "0.9.0-r1"
__version__ = "0.9.0-r2"

View file

@ -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:

View file

@ -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])

View file

@ -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):

View file

@ -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"],
@ -50,11 +50,6 @@ def github_link(project, version, egg):
return "https://github.com/%s/tarball/%s/#egg=%s" % (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",

View file

@ -51,7 +51,7 @@ logger = logging.getLogger(__name__)
# Remember to update this number every time a change is made to database
# schema files, so the users will be informed on server restarts.
SCHEMA_VERSION = 17
SCHEMA_VERSION = 18
dir_path = os.path.abspath(os.path.dirname(__file__))

View file

@ -0,0 +1,32 @@
/* Copyright 2015 OpenMarket Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
CREATE TABLE IF NOT EXISTS new_server_keys_json (
server_name TEXT NOT NULL, -- Server name.
key_id TEXT NOT NULL, -- Requested key id.
from_server TEXT NOT NULL, -- Which server the keys were fetched from.
ts_added_ms BIGINT NOT NULL, -- When the keys were fetched
ts_valid_until_ms BIGINT NOT NULL, -- When this version of the keys exipires.
key_json bytea NOT NULL, -- JSON certificate for the remote server.
CONSTRAINT server_keys_json_uniqueness UNIQUE (server_name, key_id, from_server)
);
INSERT INTO new_server_keys_json
SELECT server_name, key_id, from_server,ts_added_ms, ts_valid_until_ms, key_json FROM server_keys_json ;
DROP TABLE server_keys_json;
ALTER TABLE new_server_keys_json RENAME TO server_keys_json;