synapse/handlers/device.py
def _need_to_do_resync(self, user_id, updates):
        """Given a list of updates for a user figure out if we need to do a full
        resync, or whether we have enough data that we can just apply the delta.
        """
        seen_updates = self._seen_updates.get(user_id, set())

        extremity = yield self.store.get_device_list_last_stream_id_for_remote(
            user_id
        )

        stream_id_in_updates = set()  # stream_ids in updates list
        for _, stream_id, prev_ids, _ in updates:
            if not prev_ids:
                # We always do a resync if there are no previous IDs
                defer.returnValue(True)

            for prev_id in prev_ids:
                if prev_id == extremity:
                    continue
                elif prev_id in seen_updates:
                    continue
                elif prev_id in stream_id_in_updates:
                    continue
                else:
                    defer.returnValue(True)

            stream_id_in_updates.add(stream_id)

        defer.returnValue(False)
Given a list of updates for a user figure out if we need to do a full
        resync, or whether we have enough data that we can just apply the delta.
        
Given a list of updates for a user figure out if we need to do a full
resync, or whether we have enough data that we can just apply the delta.
Given a list of updates for a user figure out if we need to do a full resync or whether we have enough data that we can just apply the delta .
def _need_to_do_resync(self, user_id, updates):
        seen_updates = self._seen_updates.get(user_id, set())
        extremity = yield self.store.get_device_list_last_stream_id_for_remote(
            user_id
        )
        stream_id_in_updates = set()  
        for _, stream_id, prev_ids, _ in updates:
            if not prev_ids:
                defer.returnValue(True)
            for prev_id in prev_ids:
                if prev_id == extremity:
                    continue
                elif prev_id in seen_updates:
                    continue
                elif prev_id in stream_id_in_updates:
                    continue
                else:
                    defer.returnValue(True)
            stream_id_in_updates.add(stream_id)
        defer.returnValue(False)
def _need_to_do_resync ( self , user_id , updates ) : seen_updates = self . _seen_updates . get ( user_id , set ( ) ) extremity = yield self . store . get_device_list_last_stream_id_for_remote ( user_id ) stream_id_in_updates = set ( ) for _ , stream_id , prev_ids , _ in updates : if not prev_ids : defer . returnValue ( True ) for prev_id in prev_ids : if prev_id == extremity : continue elif prev_id in seen_updates : continue elif prev_id in stream_id_in_updates : continue else : defer . returnValue ( True ) stream_id_in_updates . add ( stream_id ) defer . returnValue ( False )
Given a list of updates for a user figure out if we need to do a full
resync, or whether we have enough data that we can just apply the delta.
Given a list of updates for a user figure out if we need to do a full resync or whether we have enough data that we can just apply the delta .
"""Given a list of updates for a user figure out if we need to do a full
        resync, or whether we have enough data that we can just apply the delta.
        """ # stream_ids in updates list # We always do a resync if there are no previous IDs
self
user_id
updates