diff options
author | Richard van der Hoff <richard@matrix.org> | 2020-01-03 16:30:51 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2020-01-06 13:45:33 +0000 |
commit | dc41fbf0dda981df117d8cf1938e023a38836cda (patch) | |
tree | 50a4f4841515468b2f25659a609c3b0a13deb313 /synapse | |
parent | Remove unused hashes and depths from _update_membership params (diff) | |
download | synapse-dc41fbf0dda981df117d8cf1938e023a38836cda.tar.xz |
Remove unused get_prev_events_and_hashes_for_room
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/storage/data_stores/main/event_federation.py | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/synapse/storage/data_stores/main/event_federation.py b/synapse/storage/data_stores/main/event_federation.py index 88e6489576..32e76621a7 100644 --- a/synapse/storage/data_stores/main/event_federation.py +++ b/synapse/storage/data_stores/main/event_federation.py @@ -14,7 +14,6 @@ # limitations under the License. import itertools import logging -import random from six.moves import range from six.moves.queue import Empty, PriorityQueue @@ -148,35 +147,6 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas retcol="event_id", ) - @defer.inlineCallbacks - def get_prev_events_and_hashes_for_room(self, room_id): - """ - Gets a subset of the current forward extremities in the given room, - along with their depths and hashes. - - Limits the result to 10 extremities, so that we can avoid creating - events which refer to hundreds of prev_events. - - Args: - room_id (str): room_id - - Returns: - Deferred[list[(str, dict[str, str], int)]] - for each event, a tuple of (event_id, hashes, depth) - where *hashes* is a map from algorithm to hash. - """ - res = yield self.get_latest_event_ids_and_hashes_in_room(room_id) - if len(res) > 10: - # Sort by reverse depth, so we point to the most recent. - res.sort(key=lambda a: -a[2]) - - # we use half of the limit for the actual most recent events, and - # the other half to randomly point to some of the older events, to - # make sure that we don't completely ignore the older events. - res = res[0:5] + random.sample(res[5:], 5) - - return res - def get_prev_events_for_room(self, room_id: str): """ Gets a subset of the current forward extremities in the given room. |