summary refs log tree commit diff
path: root/synapse/storage/keys.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-04-30 16:54:55 +0100
committerMark Haines <mark.haines@matrix.org>2015-04-30 16:54:55 +0100
commit2d4d2bbae4f35e3128fa492e45cfc5b0750524bc (patch)
tree8e3fa03a60443dc2a1af80d5fb13aa0e28ffddca /synapse/storage/keys.py
parentWrite a default log_config when generating config (diff)
parentAdd get_rooms_for_user cache (diff)
downloadsynapse-2d4d2bbae4f35e3128fa492e45cfc5b0750524bc.tar.xz
Merge branch 'develop' into markjh/config_cleanup
Conflicts:
	synapse/config/captcha.py
Diffstat (limited to 'synapse/storage/keys.py')
-rw-r--r--synapse/storage/keys.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/keys.py b/synapse/storage/keys.py
index cbe9339ccf..5bdf497b93 100644
--- a/synapse/storage/keys.py
+++ b/synapse/storage/keys.py
@@ -137,8 +137,13 @@ class KeyStore(SQLBaseStore):
             ts_valid_until_ms (int): The time when this json stops being valid.
             key_json (bytes): The encoded JSON.
         """
-        return self._simple_insert(
+        return self._simple_upsert(
             table="server_keys_json",
+            keyvalues={
+                "server_name": server_name,
+                "key_id": key_id,
+                "from_server": from_server,
+            },
             values={
                 "server_name": server_name,
                 "key_id": key_id,
@@ -147,7 +152,6 @@ class KeyStore(SQLBaseStore):
                 "ts_valid_until_ms": ts_expires_ms,
                 "key_json": buffer(key_json_bytes),
             },
-            or_replace=True,
         )
 
     def get_server_keys_json(self, server_keys):