Skip to content
Snippets Groups Projects
Unverified Commit 469b66c1 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Merge pull request #4829 from matrix-org/erikj/device_list_seen_updates

When re-syncing device lists reset the state
parents 436b1c8b cef80da9
No related branches found
No related tags found
No related merge requests found
Fix potential race in handling missing updates in device list updates.
...@@ -597,6 +597,10 @@ class DeviceListEduUpdater(object): ...@@ -597,6 +597,10 @@ class DeviceListEduUpdater(object):
) )
device_ids = [device["device_id"] for device in devices] device_ids = [device["device_id"] for device in devices]
yield self.device_handler.notify_device_update(user_id, device_ids) 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: else:
# Simply update the single device, since we know that is the only # Simply update the single device, since we know that is the only
# change (because of the single prev_id matching the current cache) # change (because of the single prev_id matching the current cache)
...@@ -609,9 +613,9 @@ class DeviceListEduUpdater(object): ...@@ -609,9 +613,9 @@ class DeviceListEduUpdater(object):
user_id, [device_id for device_id, _, _, _ in pending_updates] user_id, [device_id for device_id, _, _, _ in pending_updates]
) )
self._seen_updates.setdefault(user_id, set()).update( self._seen_updates.setdefault(user_id, set()).update(
stream_id for _, stream_id, _, _ in pending_updates stream_id for _, stream_id, _, _ in pending_updates
) )
@defer.inlineCallbacks @defer.inlineCallbacks
def _need_to_do_resync(self, user_id, updates): def _need_to_do_resync(self, user_id, updates):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment