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

Add depth parameter and pipe through the event creation methods #10049

Closed
wants to merge 9 commits into from

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented May 24, 2021

Add depth parameter and pipe through the event creation methods. Also add auth_event_ids and prev_event_ids in some places as well so I don't have to go through PR splitting conflict hell.

Split out from #9247

Call stacks:

create_and_send_nonmember_event
create_event
create_new_client_event
builder.build
update_membership
update_membership_locked
_local_membership_update
create_event

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
  • Pull request includes a sign off
  • Code style is correct (run the linters)

@@ -496,160 +561,170 @@ async def update_membership_locked(
if block_invite:
raise SynapseError(403, "Invites have been disabled on this server")

latest_event_ids = await self.store.get_prev_events_for_room(room_id)
if prev_event_ids:
latest_event_ids = prev_event_ids
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New case is here where we override the prev_event_ids if passed in explicitly

https://github.com/matrix-org/synapse/pull/9247/files#r610994535

if prev_event_ids:
latest_event_ids = prev_event_ids
else:
latest_event_ids = await self.store.get_prev_events_for_room(room_id)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this code is just nested under the else conditional and not changed.

https://github.com/matrix-org/synapse/pull/9247/files#r610994518

@MadLittleMods MadLittleMods force-pushed the madlittlemods/pipe-inherit_depth branch 3 times, most recently from 697949c to b9952cf Compare May 24, 2021 06:06
@MadLittleMods MadLittleMods changed the title Pipe the inherit_depth parameter through the event creation methods Add inherit_depth parameter and pipe through the event creation methods May 24, 2021
@MadLittleMods MadLittleMods force-pushed the madlittlemods/pipe-inherit_depth branch from b9952cf to 280d6da Compare May 24, 2021 06:11
Also add auth_event_ids and prev_event_ids in some places as well.

Split out from #9247

Call stacks:
```
create_and_send_nonmember_event
create_event
create_new_client_event
builder.build
```

```
update_membership
update_membership_locked
_local_membership_update
create_event
```
@MadLittleMods MadLittleMods force-pushed the madlittlemods/pipe-inherit_depth branch from 280d6da to 3e747bc Compare May 24, 2021 06:17
oldest_successor_depth,
) = await self._store.get_min_depth_of(successor_event_ids)

depth = oldest_successor_depth
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The smarts of inherit_depth are here 🎈

Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like changes that would work :)

synapse/handlers/room_member.py Outdated Show resolved Hide resolved
@MadLittleMods
Copy link
Contributor Author

I feel like the remaining failing Sytest tests are just flakey. They are different when I re-run them.

Trying to get it running locally to confirm, matrix-org/sytest#1054

Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good other than tiny nit

synapse/handlers/message.py Outdated Show resolved Hide resolved
@MadLittleMods MadLittleMods force-pushed the madlittlemods/pipe-inherit_depth branch from 63bf8f6 to bd28bda Compare June 2, 2021 18:29
@MadLittleMods
Copy link
Contributor Author

@erikjohnston Thanks for all the review so far 🎢

@erikjohnston
Copy link
Member

I think this is good to merge, but I'm going to hold off a bit until we #9247 is a bit closer (in particular I'm wondering if we should pass in the depth explicitly, rather than have inherit_depth). Thanks for splitting it out from that PR though, it was helpful to be able to review it separately :)

MadLittleMods added a commit that referenced this pull request Jun 6, 2021
MadLittleMods added a commit that referenced this pull request Jun 6, 2021
@MadLittleMods
Copy link
Contributor Author

@erikjohnston I've updated this PR and the base PR to pass around depth directly 👍

@MadLittleMods MadLittleMods requested review from erikjohnston and removed request for erikjohnston June 6, 2021 21:26
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks, but again let's wait for the other PR before landing this

synapse/events/builder.py Outdated Show resolved Hide resolved
@MadLittleMods MadLittleMods changed the title Add inherit_depth parameter and pipe through the event creation methods Add depth parameter and pipe through the event creation methods Jun 7, 2021
@MadLittleMods MadLittleMods deleted the madlittlemods/pipe-inherit_depth branch September 7, 2021 20:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants