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

Mainline matrix-org-hotfixes changes to RoomMemberHandler.update_membership #11995

@babolivier

Description

@babolivier

Specifically this bit:

as_id = object()
if requester.app_service:
as_id = requester.app_service.id
then = self.clock.time_msec()
with (await self.member_limiter.queue(as_id)):
diff = self.clock.time_msec() - then
if diff > 80 * 1000:
# haproxy would have timed the request out anyway...
raise SynapseError(504, "took to long to process")
with (await self.member_linearizer.queue(key)):
diff = self.clock.time_msec() - then
if diff > 80 * 1000:
# haproxy would have timed the request out anyway...
raise SynapseError(504, "took to long to process")
result = await self.update_membership_locked(
requester,
target,
room_id,
action,
txn_id=txn_id,
remote_room_hosts=remote_room_hosts,
third_party_signed=third_party_signed,
ratelimit=ratelimit,
content=content,
new_room=new_room,
require_consent=require_consent,
outlier=outlier,
historical=historical,
prev_event_ids=prev_event_ids,
auth_event_ids=auth_event_ids,
)

It's been causing merge conflicts when merging release branches into matrix-org-hotfixes a few times lately due to new releases adding kwargs to update_membership_locked, e.g.:

diff --cc synapse/handlers/room_member.py
index 8ee1a6470,bf1a47efb..000000000
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@@ -483,43 -500,25 +501,65 @@@ class RoomMemberHandler(metaclass=abc.A
  
          key = (room_id,)
  
++<<<<<<< HEAD
 +        as_id = object()
 +        if requester.app_service:
 +            as_id = requester.app_service.id
 +
 +        then = self.clock.time_msec()
 +
 +        with (await self.member_limiter.queue(as_id)):
 +            diff = self.clock.time_msec() - then
 +
 +            if diff > 80 * 1000:
 +                # haproxy would have timed the request out anyway...
 +                raise SynapseError(504, "took to long to process")
 +
 +            with (await self.member_linearizer.queue(key)):
 +                diff = self.clock.time_msec() - then
 +
 +                if diff > 80 * 1000:
 +                    # haproxy would have timed the request out anyway...
 +                    raise SynapseError(504, "took to long to process")
 +
 +                result = await self.update_membership_locked(
 +                    requester,
 +                    target,
 +                    room_id,
 +                    action,
 +                    txn_id=txn_id,
 +                    remote_room_hosts=remote_room_hosts,
 +                    third_party_signed=third_party_signed,
 +                    ratelimit=ratelimit,
 +                    content=content,
 +                    new_room=new_room,
 +                    require_consent=require_consent,
 +                    outlier=outlier,
 +                    historical=historical,
 +                    prev_event_ids=prev_event_ids,
 +                    auth_event_ids=auth_event_ids,
 +                )
++=======
+         with (await self.member_linearizer.queue(key)):
+             result = await self.update_membership_locked(
+                 requester,
+                 target,
+                 room_id,
+                 action,
+                 txn_id=txn_id,
+                 remote_room_hosts=remote_room_hosts,
+                 third_party_signed=third_party_signed,
+                 ratelimit=ratelimit,
+                 content=content,
+                 new_room=new_room,
+                 require_consent=require_consent,
+                 outlier=outlier,
+                 historical=historical,
+                 allow_no_prev_events=allow_no_prev_events,
+                 prev_event_ids=prev_event_ids,
+                 auth_event_ids=auth_event_ids,
+             )
++>>>>>>> release-v1.53
  
          return result

When merging the 1.53 release branch today. Resolving the conflict isn't difficult (just add the new kwargs to the update_membership_locked call) but it's not the first time we're running into this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions