diff options
author | Erik Johnston <erik@matrix.org> | 2014-10-31 17:48:05 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-10-31 17:48:05 +0000 |
commit | b63691f6e205b4e2d2a990ff04318e4daf731e2c (patch) | |
tree | aa7a80d740c7ba8f7f5ce9fe28dc32c523746d53 /synapse/storage | |
parent | Coturn's timestamps are in seconds, not milliseconds (diff) | |
parent | Bump version numbers and change log (diff) | |
download | synapse-b63691f6e205b4e2d2a990ff04318e4daf731e2c.tar.xz |
Merge branch 'release-v0.4.2' of github.com:matrix-org/synapse v0.4.2
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/__init__.py | 7 | ||||
-rw-r--r-- | synapse/storage/keys.py | 4 | ||||
-rw-r--r-- | synapse/storage/roommember.py | 8 |
3 files changed, 11 insertions, 8 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index 3aa6345a7f..4e9291fdff 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -452,10 +452,11 @@ def prepare_database(db_conn): db_conn.commit() else: + sql_script = "BEGIN TRANSACTION;" for sql_loc in SCHEMAS: - sql_script = read_schema(sql_loc) - - c.executescript(sql_script) + sql_script += read_schema(sql_loc) + sql_script += "COMMIT TRANSACTION;" + c.executescript(sql_script) db_conn.commit() c.execute("PRAGMA user_version = %d" % SCHEMA_VERSION) diff --git a/synapse/storage/keys.py b/synapse/storage/keys.py index 8189e071a3..fd705138e6 100644 --- a/synapse/storage/keys.py +++ b/synapse/storage/keys.py @@ -18,9 +18,10 @@ from _base import SQLBaseStore from twisted.internet import defer import OpenSSL -from syutil.crypto.signing_key import decode_verify_key_bytes +from syutil.crypto.signing_key import decode_verify_key_bytes import hashlib + class KeyStore(SQLBaseStore): """Persistence for signature verification keys and tls X.509 certificates """ @@ -104,7 +105,6 @@ class KeyStore(SQLBaseStore): ts_now_ms (int): The time now in milliseconds verification_key (VerifyKey): The NACL verify key. """ - verify_key_bytes = verify_key.encode() return self._simple_insert( table="server_signature_keys", values={ diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index ceeef5880e..93329703a2 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -33,7 +33,9 @@ class RoomMemberStore(SQLBaseStore): target_user_id = event.state_key domain = self.hs.parse_userid(target_user_id).domain except: - logger.exception("Failed to parse target_user_id=%s", target_user_id) + logger.exception( + "Failed to parse target_user_id=%s", target_user_id + ) raise logger.debug( @@ -65,7 +67,8 @@ class RoomMemberStore(SQLBaseStore): # Check if this was the last person to have left. member_events = self._get_members_query_txn( txn, - where_clause="c.room_id = ? AND m.membership = ? AND m.user_id != ?", + where_clause=("c.room_id = ? AND m.membership = ?" + " AND m.user_id != ?"), where_values=(event.room_id, Membership.JOIN, target_user_id,) ) @@ -120,7 +123,6 @@ class RoomMemberStore(SQLBaseStore): else: return None - def get_room_members(self, room_id, membership=None): """Retrieve the current room member list for a room. |