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

Commit c7fb21f

Browse files
committed
Merge commit '4876af06d' into anoa/dinsic_release_1_18_x
* commit '4876af06d': Abort federation requests if the client disconnects early (#7930)
2 parents a684f57 + 4876af0 commit c7fb21f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

changelog.d/7930.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Abort federation requests where the client disconnects before the ratelimiter expires.

synapse/federation/transport/server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ async def new_func(request, *args, **kwargs):
339339
if origin:
340340
with ratelimiter.ratelimit(origin) as d:
341341
await d
342+
if request._disconnected:
343+
logger.warning(
344+
"client disconnected before we started processing "
345+
"request"
346+
)
347+
return -1, None
342348
response = await func(
343349
origin, content, request.args, *args, **kwargs
344350
)

0 commit comments

Comments
 (0)