diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-07 12:08:35 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-07 12:08:35 +0100 |
commit | 0af5f5efaf0b24187514cf78d7982ef9b85a208c (patch) | |
tree | 5f1b40032b349e5743af333124d6fcea0b5213e0 /synapse/storage/events.py | |
parent | Implement or_ignore flag on inserts (diff) | |
download | synapse-0af5f5efaf0b24187514cf78d7982ef9b85a208c.tar.xz |
Don't use multiple UNIQUE constraints; it will cause deadlocks
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 514feebcbf..3b3416716e 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -179,7 +179,7 @@ class EventsStore(SQLBaseStore): ) txn.execute( sql, - (metadata_json.decode("UTF-8"), event.event_id,) + (buffer(metadata_json), event.event_id,) ) sql = ( @@ -224,14 +224,14 @@ class EventsStore(SQLBaseStore): values={ "event_id": event.event_id, "room_id": event.room_id, - "internal_metadata": metadata_json.decode("UTF-8"), - "json": encode_canonical_json(event_dict).decode("UTF-8"), + "internal_metadata": buffer(metadata_json), + "json": buffer(encode_canonical_json(event_dict)), }, ) - content = encode_canonical_json( + content = buffer(encode_canonical_json( event.content - ).decode("UTF-8") + )) vals = { "topological_ordering": event.depth, @@ -256,9 +256,9 @@ class EventsStore(SQLBaseStore): ] } - vals["unrecognized_keys"] = encode_canonical_json( + vals["unrecognized_keys"] = buffer(encode_canonical_json( unrec - ).decode("UTF-8") + )) sql = ( "INSERT INTO events" |