summary refs log tree commit diff
path: root/synapse/rest/key/v2
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-01-04 10:04:50 -0500
committerGitHub <noreply@github.com>2021-01-04 10:04:50 -0500
commit1c9a8505623475ae28067e6f0e8e74ede70c728a (patch)
tree06b2b63dd07b69fb0ff7e99c2c28c1b57093ac37 /synapse/rest/key/v2
parentAdd link to Synapse dev room to the relevant README section (#9002) (diff)
downloadsynapse-1c9a8505623475ae28067e6f0e8e74ede70c728a.tar.xz
Add type hints to the crypto module. (#8999)
Diffstat (limited to 'synapse/rest/key/v2')
-rw-r--r--synapse/rest/key/v2/remote_key_resource.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/rest/key/v2/remote_key_resource.py b/synapse/rest/key/v2/remote_key_resource.py
index f843f02454..c57ac22e58 100644
--- a/synapse/rest/key/v2/remote_key_resource.py
+++ b/synapse/rest/key/v2/remote_key_resource.py
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 import logging
-from typing import Dict, Set
+from typing import Dict
 
 from signedjson.sign import sign_json
 
@@ -142,12 +142,13 @@ class RemoteKey(DirectServeJsonResource):
 
         time_now_ms = self.clock.time_msec()
 
-        cache_misses = {}  # type: Dict[str, Set[str]]
+        # Note that the value is unused.
+        cache_misses = {}  # type: Dict[str, Dict[str, int]]
         for (server_name, key_id, from_server), results in cached.items():
             results = [(result["ts_added_ms"], result) for result in results]
 
             if not results and key_id is not None:
-                cache_misses.setdefault(server_name, set()).add(key_id)
+                cache_misses.setdefault(server_name, {})[key_id] = 0
                 continue
 
             if key_id is not None:
@@ -201,7 +202,7 @@ class RemoteKey(DirectServeJsonResource):
                     )
 
                 if miss:
-                    cache_misses.setdefault(server_name, set()).add(key_id)
+                    cache_misses.setdefault(server_name, {})[key_id] = 0
                 # Cast to bytes since postgresql returns a memoryview.
                 json_results.add(bytes(most_recent_result["key_json"]))
             else: