diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index edc33e466a..7d509f9e08 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -246,8 +246,22 @@ class RoomMemberHandler(object): if requester.app_service: as_id = requester.app_service.id + then = self.clock.time_msec() + with (yield self.member_limiter.queue(as_id)): + diff = self.clock.time_msec() - then + + if diff > 90 * 1000: + # haproxy would have timed the request out anyway... + raise SynapseError(504, "took to long to process") + with (yield self.member_linearizer.queue(key)): + diff = self.clock.time_msec() - then + + if diff > 90 * 1000: + # haproxy would have timed the request out anyway... + raise SynapseError(504, "took to long to process") + result = yield self._update_membership( requester, target,