summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room_member.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py

index 1d8b0aee6f..2443c33c33 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py
@@ -609,10 +609,24 @@ class RoomMemberHandler(metaclass=abc.ABCMeta): if requester.app_service: as_id = requester.app_service.id + then = self.clock.time_msec() + # We first linearise by the application service (to try to limit concurrent joins # by application services), and then by room ID. async with self.member_as_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") + async with 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") + with opentracing.start_active_span("update_membership_locked"): result = await self.update_membership_locked( requester,