Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7d850db

Browse files
committed
Add more better comments
1 parent dfad8a8 commit 7d850db

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

synapse/rest/client/v1/room.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,18 @@ async def _inherit_depth_from_prev_ids(self, prev_event_ids) -> int:
358358
return depth
359359

360360
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
363362
and a random chunk ID.
363+
364364
Args:
365365
sender: The event author MXID
366366
origin_server_ts: Timestamp when the event was sent
367+
367368
Returns:
368369
Tuple of event ID and stream ordering position
369370
"""
370371

371-
next_chunk_id = random_string(64)
372+
next_chunk_id = random_string(8)
372373
insertion_event = {
373374
"type": EventTypes.MSC2716_INSERTION,
374375
"sender": sender,
@@ -493,8 +494,13 @@ async def on_POST(self, request, room_id):
493494
if chunk_id_from_query:
494495
# TODO: Verify the chunk_id_from_query corresponds to an insertion event
495496
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.
498504
else:
499505
base_insertion_event = self._create_insertion_event_dict(
500506
sender=requester.user.to_string(),

0 commit comments

Comments
 (0)