mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Prefill forward extrems and event to state groups
This commit is contained in:
parent
d800ab2847
commit
5946aa0877
@ -403,6 +403,11 @@ class EventsStore(SQLBaseStore):
|
|||||||
(room_id, ), new_state
|
(room_id, ), new_state
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for room_id, latest_event_ids in new_forward_extremeties.iteritems():
|
||||||
|
self.get_latest_event_ids_in_room.prefill(
|
||||||
|
(room_id,), latest_event_ids
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _calculate_new_extremeties(self, room_id, event_contexts, latest_event_ids):
|
def _calculate_new_extremeties(self, room_id, event_contexts, latest_event_ids):
|
||||||
"""Calculates the new forward extremeties for a room given events to
|
"""Calculates the new forward extremeties for a room given events to
|
||||||
|
@ -315,6 +315,12 @@ class StateStore(SQLBaseStore):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for event_id, state_group_id in state_groups.iteritems():
|
||||||
|
txn.call_after(
|
||||||
|
self._get_state_group_for_event.prefill,
|
||||||
|
(event_id,), state_group_id
|
||||||
|
)
|
||||||
|
|
||||||
def _count_state_group_hops_txn(self, txn, state_group):
|
def _count_state_group_hops_txn(self, txn, state_group):
|
||||||
"""Given a state group, count how many hops there are in the tree.
|
"""Given a state group, count how many hops there are in the tree.
|
||||||
|
|
||||||
@ -584,8 +590,8 @@ class StateStore(SQLBaseStore):
|
|||||||
state_map = yield self.get_state_ids_for_events([event_id], types)
|
state_map = yield self.get_state_ids_for_events([event_id], types)
|
||||||
defer.returnValue(state_map[event_id])
|
defer.returnValue(state_map[event_id])
|
||||||
|
|
||||||
@cached(num_args=2, max_entries=50000)
|
@cached(max_entries=50000)
|
||||||
def _get_state_group_for_event(self, room_id, event_id):
|
def _get_state_group_for_event(self, event_id):
|
||||||
return self._simple_select_one_onecol(
|
return self._simple_select_one_onecol(
|
||||||
table="event_to_state_groups",
|
table="event_to_state_groups",
|
||||||
keyvalues={
|
keyvalues={
|
||||||
|
Loading…
Reference in New Issue
Block a user