@@ -214,7 +214,7 @@ async def on_receive_pdu(self, origin: str, pdu: EventBase) -> None:
214
214
215
215
if missing_prevs :
216
216
# We only backfill backwards to the min depth.
217
- min_depth = await self .get_min_depth_for_context (pdu .room_id )
217
+ min_depth = await self ._store . get_min_depth (pdu .room_id )
218
218
logger .debug ("min_depth: %d" , min_depth )
219
219
220
220
if min_depth is not None and pdu .depth > min_depth :
@@ -1696,16 +1696,27 @@ async def _run_push_actions_and_persist_event(
1696
1696
# persist_events_and_notify directly.)
1697
1697
assert not event .internal_metadata .outlier
1698
1698
1699
- try :
1700
- if (
1701
- not backfilled
1702
- and not context .rejected
1703
- and (await self ._store .get_min_depth (event .room_id )) <= event .depth
1704
- ):
1699
+ if not backfilled and not context .rejected :
1700
+ min_depth = await self ._store .get_min_depth (event .room_id )
1701
+ if min_depth is None or min_depth > event .depth :
1702
+ # XXX richvdh 2021/10/07: I don't really understand what this
1703
+ # condition is doing. I think it's trying not to send pushes
1704
+ # for events that predate our join - but that's not really what
1705
+ # min_depth means, and anyway ancient events are a more general
1706
+ # problem.
1707
+ #
1708
+ # for now I'm just going to log about it.
1709
+ logger .info (
1710
+ "Skipping push actions for old event with depth %s < %s" ,
1711
+ event .depth ,
1712
+ min_depth ,
1713
+ )
1714
+ else :
1705
1715
await self ._action_generator .handle_push_actions_for_event (
1706
1716
event , context
1707
1717
)
1708
1718
1719
+ try :
1709
1720
await self .persist_events_and_notify (
1710
1721
event .room_id , [(event , context )], backfilled = backfilled
1711
1722
)
@@ -1837,6 +1848,3 @@ def _sanity_check_event(self, ev: EventBase) -> None:
1837
1848
len (ev .auth_event_ids ()),
1838
1849
)
1839
1850
raise SynapseError (HTTPStatus .BAD_REQUEST , "Too many auth_events" )
1840
-
1841
- async def get_min_depth_for_context (self , context : str ) -> int :
1842
- return await self ._store .get_min_depth (context )
0 commit comments