Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 37feb40

Browse files
committed
Merge branch 'hotfixes-v0.9.0-r2' of github.com:matrix-org/synapse
2 parents 52f98f8 + 0cd1401 commit 37feb40

File tree

7 files changed

+67
-19
lines changed

7 files changed

+67
-19
lines changed

synapse/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
""" This is a reference implementation of a Matrix home server.
1717
"""
1818

19-
__version__ = "0.9.0-r1"
19+
__version__ = "0.9.0-r2"

synapse/app/homeserver.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,31 @@ def log(self, request):
496496

497497

498498
def run(hs):
499+
PROFILE_SYNAPSE = False
500+
if PROFILE_SYNAPSE:
501+
def profile(func):
502+
from cProfile import Profile
503+
from threading import current_thread
504+
505+
def profiled(*args, **kargs):
506+
profile = Profile()
507+
profile.enable()
508+
func(*args, **kargs)
509+
profile.disable()
510+
ident = current_thread().ident
511+
profile.dump_stats("/tmp/%s.%s.%i.pstat" % (
512+
hs.hostname, func.__name__, ident
513+
))
514+
515+
return profiled
516+
517+
from twisted.python.threadpool import ThreadPool
518+
ThreadPool._worker = profile(ThreadPool._worker)
519+
reactor.run = profile(reactor.run)
499520

500521
def in_thread():
501522
with LoggingContext("run"):
502523
change_resource_limit(hs.config.soft_file_limit)
503-
504524
reactor.run()
505525

506526
if hs.config.daemonize:

synapse/app/synctl.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@
2727
GREEN = "\x1b[1;32m"
2828
NORMAL = "\x1b[m"
2929

30+
if not os.path.exists(CONFIGFILE):
31+
sys.stderr.write(
32+
"No config file found\n"
33+
"To generate a config file, run '%s -c %s --generate-config"
34+
" --server-name=<server name>'\n" % (
35+
" ".join(SYNAPSE), CONFIGFILE
36+
)
37+
)
38+
sys.exit(1)
39+
3040
CONFIG = yaml.load(open(CONFIGFILE))
3141
PIDFILE = CONFIG["pid_file"]
3242

3343

3444
def start():
35-
if not os.path.exists(CONFIGFILE):
36-
sys.stderr.write(
37-
"No config file found\n"
38-
"To generate a config file, run '%s -c %s --generate-config"
39-
" --server-name=<server name>'\n" % (
40-
" ".join(SYNAPSE), CONFIGFILE
41-
)
42-
)
43-
sys.exit(1)
4445
print "Starting ...",
4546
args = SYNAPSE
4647
args.extend(["--daemonize", "-c", CONFIGFILE])

synapse/config/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def load_config(cls, description, argv, generate_section=None):
157157

158158
server_name = config_args.server_name
159159
if not server_name:
160-
print "Most specify a server_name to a generate config for."
160+
print "Must specify a server_name to a generate config for."
161161
sys.exit(1)
162162
(config_path,) = config_args.config_path
163163
if not os.path.exists(config_dir_path):

synapse/python_dependencies.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"pyopenssl>=0.14": ["OpenSSL>=0.14"],
2525
"pyyaml": ["yaml"],
2626
"pyasn1": ["pyasn1"],
27-
"pynacl": ["nacl"],
27+
"pynacl>=0.0.3": ["nacl>=0.0.3"],
2828
"daemonize": ["daemonize"],
2929
"py-bcrypt": ["bcrypt"],
3030
"frozendict>=0.4": ["frozendict"],
@@ -50,11 +50,6 @@ def github_link(project, version, egg):
5050
return "https://github.com/%s/tarball/%s/#egg=%s" % (project, version, egg)
5151

5252
DEPENDENCY_LINKS = [
53-
github_link(
54-
project="pyca/pynacl",
55-
version="d4d3175589b892f6ea7c22f466e0e223853516fa",
56-
egg="pynacl-0.3.0",
57-
),
5853
github_link(
5954
project="matrix-org/syutil",
6055
version="v0.0.6",

synapse/storage/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
# Remember to update this number every time a change is made to database
5353
# schema files, so the users will be informed on server restarts.
54-
SCHEMA_VERSION = 17
54+
SCHEMA_VERSION = 18
5555

5656
dir_path = os.path.abspath(os.path.dirname(__file__))
5757

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Copyright 2015 OpenMarket Ltd
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
17+
CREATE TABLE IF NOT EXISTS new_server_keys_json (
18+
server_name TEXT NOT NULL, -- Server name.
19+
key_id TEXT NOT NULL, -- Requested key id.
20+
from_server TEXT NOT NULL, -- Which server the keys were fetched from.
21+
ts_added_ms BIGINT NOT NULL, -- When the keys were fetched
22+
ts_valid_until_ms BIGINT NOT NULL, -- When this version of the keys exipires.
23+
key_json bytea NOT NULL, -- JSON certificate for the remote server.
24+
CONSTRAINT server_keys_json_uniqueness UNIQUE (server_name, key_id, from_server)
25+
);
26+
27+
INSERT INTO new_server_keys_json
28+
SELECT server_name, key_id, from_server,ts_added_ms, ts_valid_until_ms, key_json FROM server_keys_json ;
29+
30+
DROP TABLE server_keys_json;
31+
32+
ALTER TABLE new_server_keys_json RENAME TO server_keys_json;

0 commit comments

Comments
 (0)