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

Commit

Permalink
Timeout membership requests after 90s
Browse files Browse the repository at this point in the history
This is a hacky fix to try and stop in flight requests from building up
  • Loading branch information
erikjohnston committed Jul 2, 2018
1 parent 6a95270 commit ca21957
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,22 @@ def update_membership(
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,
Expand Down

0 comments on commit ca21957

Please sign in to comment.