@@ -350,17 +350,18 @@ async def inherit_depth_from_prev_ids(self, prev_event_ids) -> int:
350
350
return depth
351
351
352
352
def _create_insertion_event_dict (self , sender : str , origin_server_ts : int ):
353
- """
354
- Creates an event dict for an "insertion" event with the proper fields
353
+ """Creates an event dict for an "insertion" event with the proper fields
355
354
and a random chunk ID.
355
+
356
356
Args:
357
357
sender: The event author MXID
358
358
origin_server_ts: Timestamp when the event was sent
359
+
359
360
Returns:
360
361
Tuple of event ID and stream ordering position
361
362
"""
362
363
363
- next_chunk_id = random_string (64 )
364
+ next_chunk_id = random_string (8 )
364
365
insertion_event = {
365
366
"type" : EventTypes .MSC2716_INSERTION ,
366
367
"sender" : sender ,
@@ -481,8 +482,13 @@ async def on_POST(self, request, room_id):
481
482
if chunk_id_from_query :
482
483
# TODO: Verify the chunk_id_from_query corresponds to an insertion event
483
484
pass
484
- # Otherwise, create an insertion event to be based off of and connect
485
- # to as a starting point.
485
+ # Otherwise, create an insertion event to act as a starting point.
486
+ #
487
+ # We don't always have an insertion event to start hanging more history
488
+ # off of (ideally there would be one in the main DAG, but that's not the
489
+ # case if we're wanting to add history to e.g. existing rooms without
490
+ # an insertion event), in which case we just create a new insertion event
491
+ # that can then get pointed to by a "marker" event later.
486
492
else :
487
493
base_insertion_event = self ._create_insertion_event_dict (
488
494
sender = requester .user .to_string (),
0 commit comments