Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invite acceptance over federation #15

Merged
merged 10 commits into from
May 16, 2023
Merged

Fix invite acceptance over federation #15

merged 10 commits into from
May 16, 2023

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented May 11, 2023

This PR fixes a race condition which caused accepting invites over federation to fail. It adds a function which runs as a background process which retries the update_room_membership call several times if an exception is raised by update_room_membership. Fixes #12.

The associated PR in Synapse is matrix-org/synapse#15577.

@H-Shay H-Shay requested a review from a team as a code owner May 11, 2023 22:28
@H-Shay H-Shay marked this pull request as draft May 11, 2023 22:31
@H-Shay H-Shay removed the request for review from a team May 11, 2023 22:31
@H-Shay
Copy link
Contributor Author

H-Shay commented May 15, 2023

I don't think the explicit import of run_as_background_process will be picked up by mypy until a new version of synapse is released (this change is currently merged in develop but has not been released) so I think this is ready to review as-is.

@H-Shay H-Shay marked this pull request as ready for review May 15, 2023 20:25
@H-Shay H-Shay requested a review from a team May 15, 2023 20:25
Copy link

@MatMaul MatMaul left a comment

Choose a reason for hiding this comment

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

Just a small personal preference remark, LGTM !

synapse_auto_accept_invite/__init__.py Outdated Show resolved Hide resolved
target=target,
room_id=room_id,
new_membership=new_membership,
)
Copy link

Choose a reason for hiding this comment

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

Are we missing a break somewhere?

Copy link
Contributor Author

@H-Shay H-Shay May 16, 2023

Choose a reason for hiding this comment

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

There is a break on line 191 (still within the while loop) - would it make more sense to move it to line 183?

Copy link

Choose a reason for hiding this comment

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

I misread the code, sorry!

The if condition can be omitted if the break is moved to line 183, but I don't feel strongly about this.

@H-Shay H-Shay merged commit 936525a into main May 16, 2023
@H-Shay H-Shay deleted the shay/fix_fed_invites branch May 16, 2023 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accepting invites from federation fails
3 participants