synapse/federation/send_queue.py
def _clear_queue_before_pos(self, position_to_delete):
        """Clear all the queues from before a given position"""
        with Measure(self.clock, "send_queue._clear"):
            # Delete things out of presence maps
            keys = self.presence_changed.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.presence_changed[key]

            user_ids = set(
                user_id
                for uids in itervalues(self.presence_changed)
                for user_id in uids
            )

            to_del = [
                user_id for user_id in self.presence_map if user_id not in user_ids
            ]
            for user_id in to_del:
                del self.presence_map[user_id]

            # Delete things out of keyed edus
            keys = self.keyed_edu_changed.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.keyed_edu_changed[key]

            live_keys = set()
            for edu_key in self.keyed_edu_changed.values():
                live_keys.add(edu_key)

            to_del = [edu_key for edu_key in self.keyed_edu if edu_key not in live_keys]
            for edu_key in to_del:
                del self.keyed_edu[edu_key]

            # Delete things out of edu map
            keys = self.edus.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.edus[key]

            # Delete things out of failure map
            keys = self.failures.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.failures[key]

            # Delete things out of device map
            keys = self.device_messages.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.device_messages[key]
Clear all the queues from before a given position
Clear all the queues from before a given position
Clear all the queues from before a given position
def _clear_queue_before_pos(self, position_to_delete):
        with Measure(self.clock, "send_queue._clear"):
            keys = self.presence_changed.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.presence_changed[key]
            user_ids = set(
                user_id
                for uids in itervalues(self.presence_changed)
                for user_id in uids
            )
            to_del = [
                user_id for user_id in self.presence_map if user_id not in user_ids
            ]
            for user_id in to_del:
                del self.presence_map[user_id]
            keys = self.keyed_edu_changed.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.keyed_edu_changed[key]
            live_keys = set()
            for edu_key in self.keyed_edu_changed.values():
                live_keys.add(edu_key)
            to_del = [edu_key for edu_key in self.keyed_edu if edu_key not in live_keys]
            for edu_key in to_del:
                del self.keyed_edu[edu_key]
            keys = self.edus.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.edus[key]
            keys = self.failures.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.failures[key]
            keys = self.device_messages.keys()
            i = keys.bisect_left(position_to_delete)
            for key in keys[:i]:
                del self.device_messages[key]
def _clear_queue_before_pos ( self , position_to_delete ) : with Measure ( self . clock , "send_queue._clear" ) : keys = self . presence_changed . keys ( ) i = keys . bisect_left ( position_to_delete ) for key in keys [ : i ] : del self . presence_changed [ key ] user_ids = set ( user_id for uids in itervalues ( self . presence_changed ) for user_id in uids ) to_del = [ user_id for user_id in self . presence_map if user_id not in user_ids ] for user_id in to_del : del self . presence_map [ user_id ] keys = self . keyed_edu_changed . keys ( ) i = keys . bisect_left ( position_to_delete ) for key in keys [ : i ] : del self . keyed_edu_changed [ key ] live_keys = set ( ) for edu_key in self . keyed_edu_changed . values ( ) : live_keys . add ( edu_key ) to_del = [ edu_key for edu_key in self . keyed_edu if edu_key not in live_keys ] for edu_key in to_del : del self . keyed_edu [ edu_key ] keys = self . edus . keys ( ) i = keys . bisect_left ( position_to_delete ) for key in keys [ : i ] : del self . edus [ key ] keys = self . failures . keys ( ) i = keys . bisect_left ( position_to_delete ) for key in keys [ : i ] : del self . failures [ key ] keys = self . device_messages . keys ( ) i = keys . bisect_left ( position_to_delete ) for key in keys [ : i ] : del self . device_messages [ key ]
Clear all the queues from before a given position
Clear all the queues from before a given position
"""Clear all the queues from before a given position""" # Delete things out of presence maps # Delete things out of keyed edus # Delete things out of edu map # Delete things out of failure map # Delete things out of device map
self
position_to_delete