summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-03-08 09:54:54 +0000
committerGitHub <noreply@github.com>2019-03-08 09:54:54 +0000
commit469b66c10292f975ca9aa91693c32b02200fab87 (patch)
tree896c0a341b626026719557eca00e7a33a30c329a
parentMerge pull request #4828 from matrix-org/erikj/debug_device_lists (diff)
parentNewsfile (diff)
downloadsynapse-469b66c10292f975ca9aa91693c32b02200fab87.tar.xz
Merge pull request #4829 from matrix-org/erikj/device_list_seen_updates
When re-syncing device lists reset the state
-rw-r--r--changelog.d/4829.bugfix1
-rw-r--r--synapse/handlers/device.py10
2 files changed, 8 insertions, 3 deletions
diff --git a/changelog.d/4829.bugfix b/changelog.d/4829.bugfix
new file mode 100644

index 0000000000..b05235e215 --- /dev/null +++ b/changelog.d/4829.bugfix
@@ -0,0 +1 @@ +Fix potential race in handling missing updates in device list updates. diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py
index 03644a93cc..b398848079 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py
@@ -597,6 +597,10 @@ class DeviceListEduUpdater(object): ) device_ids = [device["device_id"] for device in devices] yield self.device_handler.notify_device_update(user_id, device_ids) + + # We clobber the seen updates since we've re-synced from a given + # point. + self._seen_updates[user_id] = set([stream_id]) else: # Simply update the single device, since we know that is the only # change (because of the single prev_id matching the current cache) @@ -609,9 +613,9 @@ class DeviceListEduUpdater(object): user_id, [device_id for device_id, _, _, _ in pending_updates] ) - self._seen_updates.setdefault(user_id, set()).update( - stream_id for _, stream_id, _, _ in pending_updates - ) + self._seen_updates.setdefault(user_id, set()).update( + stream_id for _, stream_id, _, _ in pending_updates + ) @defer.inlineCallbacks def _need_to_do_resync(self, user_id, updates):