mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-14 11:57:44 +00:00
rename get_prev_events_for_room to get_prev_events_and_hashes_for_room
... to make way for a new method which just returns the event ids
This commit is contained in:
parent
01c3c6c929
commit
5a04781643
4 changed files with 12 additions and 7 deletions
|
@ -740,7 +740,7 @@ class EventCreationHandler(object):
|
|||
% (len(prev_events_and_hashes),)
|
||||
)
|
||||
else:
|
||||
prev_events_and_hashes = yield self.store.get_prev_events_for_room(
|
||||
prev_events_and_hashes = yield self.store.get_prev_events_and_hashes_for_room(
|
||||
builder.room_id
|
||||
)
|
||||
|
||||
|
@ -1042,7 +1042,9 @@ class EventCreationHandler(object):
|
|||
# For each room we need to find a joined member we can use to send
|
||||
# the dummy event with.
|
||||
|
||||
prev_events_and_hashes = yield self.store.get_prev_events_for_room(room_id)
|
||||
prev_events_and_hashes = yield self.store.get_prev_events_and_hashes_for_room(
|
||||
room_id
|
||||
)
|
||||
|
||||
latest_event_ids = (event_id for (event_id, _, _) in prev_events_and_hashes)
|
||||
|
||||
|
|
|
@ -370,7 +370,9 @@ class RoomMemberHandler(object):
|
|||
if block_invite:
|
||||
raise SynapseError(403, "Invites have been disabled on this server")
|
||||
|
||||
prev_events_and_hashes = yield self.store.get_prev_events_for_room(room_id)
|
||||
prev_events_and_hashes = yield self.store.get_prev_events_and_hashes_for_room(
|
||||
room_id
|
||||
)
|
||||
latest_event_ids = (event_id for (event_id, _, _) in prev_events_and_hashes)
|
||||
|
||||
current_state_ids = yield self.state_handler.get_current_state_ids(
|
||||
|
|
|
@ -149,9 +149,10 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas
|
|||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_prev_events_for_room(self, room_id):
|
||||
def get_prev_events_and_hashes_for_room(self, room_id):
|
||||
"""
|
||||
Gets a subset of the current forward extremities in the given room.
|
||||
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.
|
||||
|
|
|
@ -26,7 +26,7 @@ class EventFederationWorkerStoreTestCase(tests.unittest.TestCase):
|
|||
self.store = hs.get_datastore()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def test_get_prev_events_for_room(self):
|
||||
def test_get_prev_events_and_hashes_for_room(self):
|
||||
room_id = "@ROOM:local"
|
||||
|
||||
# add a bunch of events and hashes to act as forward extremities
|
||||
|
@ -64,7 +64,7 @@ class EventFederationWorkerStoreTestCase(tests.unittest.TestCase):
|
|||
yield self.store.db.runInteraction("insert", insert_event, i)
|
||||
|
||||
# this should get the last five and five others
|
||||
r = yield self.store.get_prev_events_for_room(room_id)
|
||||
r = yield self.store.get_prev_events_and_hashes_for_room(room_id)
|
||||
self.assertEqual(10, len(r))
|
||||
for i in range(0, 5):
|
||||
el = r[i]
|
||||
|
|
Loading…
Reference in a new issue