diff options
author | Erik Johnston <erik@matrix.org> | 2017-01-30 16:55:04 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-01-30 16:55:04 +0000 |
commit | c2c9a78db9393bafed59023298e71ab2c9fc8ae7 (patch) | |
tree | f581540f64840aa934814c4b764d19ce58311657 /synapse/handlers/e2e_keys.py | |
parent | Fix query (diff) | |
download | synapse-c2c9a78db9393bafed59023298e71ab2c9fc8ae7.tar.xz |
Noop device key changes if they're the same
Diffstat (limited to 'synapse/handlers/e2e_keys.py')
-rw-r--r-- | synapse/handlers/e2e_keys.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py index a16b9def8d..49b277a1af 100644 --- a/synapse/handlers/e2e_keys.py +++ b/synapse/handlers/e2e_keys.py @@ -287,11 +287,12 @@ class E2eKeysHandler(object): device_id, user_id, time_now ) # TODO: Sign the JSON with the server key - yield self.store.set_e2e_device_keys( - user_id, device_id, time_now, - encode_canonical_json(device_keys) + changed = yield self.store.set_e2e_device_keys( + user_id, device_id, time_now, device_keys, ) - yield self.device_handler.notify_device_update(user_id, [device_id]) + if changed: + # Only notify about device updates *if* the keys actually changed + yield self.device_handler.notify_device_update(user_id, [device_id]) one_time_keys = keys.get("one_time_keys", None) if one_time_keys: |