@@ -358,17 +358,18 @@ async def _inherit_depth_from_prev_ids(self, prev_event_ids) -> int:
358
358
return depth
359
359
360
360
def _create_insertion_event_dict (self , sender : str , origin_server_ts : int ):
361
- """
362
- Creates an event dict for an "insertion" event with the proper fields
361
+ """Creates an event dict for an "insertion" event with the proper fields
363
362
and a random chunk ID.
363
+
364
364
Args:
365
365
sender: The event author MXID
366
366
origin_server_ts: Timestamp when the event was sent
367
+
367
368
Returns:
368
369
Tuple of event ID and stream ordering position
369
370
"""
370
371
371
- next_chunk_id = random_string (64 )
372
+ next_chunk_id = random_string (8 )
372
373
insertion_event = {
373
374
"type" : EventTypes .MSC2716_INSERTION ,
374
375
"sender" : sender ,
@@ -493,8 +494,13 @@ async def on_POST(self, request, room_id):
493
494
if chunk_id_from_query :
494
495
# TODO: Verify the chunk_id_from_query corresponds to an insertion event
495
496
pass
496
- # Otherwise, create an insertion event to be based off of and connect
497
- # to as a starting point.
497
+ # Otherwise, create an insertion event to act as a starting point.
498
+ #
499
+ # We don't always have an insertion event to start hanging more history
500
+ # off of (ideally there would be one in the main DAG, but that's not the
501
+ # case if we're wanting to add history to e.g. existing rooms without
502
+ # an insertion event), in which case we just create a new insertion event
503
+ # that can then get pointed to by a "marker" event later.
498
504
else :
499
505
base_insertion_event = self ._create_insertion_event_dict (
500
506
sender = requester .user .to_string (),
0 commit comments