summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2024-03-08 04:33:46 -0500
committerGitHub <noreply@github.com>2024-03-08 09:33:46 +0000
commit696cc9e802f63ba8657856d85f6982f49de14f27 (patch)
treedd704c2abb3865fd788968c97de147044ead6e8d /synapse/api/errors.py
parentFix joining remote rooms when a `on_new_event` callback is registered (#16973) (diff)
downloadsynapse-696cc9e802f63ba8657856d85f6982f49de14f27.tar.xz
Stabilize support for Retry-After header (MSC4014) (#16947)
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index b44088f9b3..dd4a1ae706 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -517,8 +517,6 @@ class InvalidCaptchaError(SynapseError):
 class LimitExceededError(SynapseError):
     """A client has sent too many requests and is being throttled."""
 
-    include_retry_after_header = False
-
     def __init__(
         self,
         limiter_name: str,
@@ -526,9 +524,10 @@ class LimitExceededError(SynapseError):
         retry_after_ms: Optional[int] = None,
         errcode: str = Codes.LIMIT_EXCEEDED,
     ):
+        # Use HTTP header Retry-After to enable library-assisted retry handling.
         headers = (
             {"Retry-After": str(math.ceil(retry_after_ms / 1000))}
-            if self.include_retry_after_header and retry_after_ms is not None
+            if retry_after_ms is not None
             else None
         )
         super().__init__(code, "Too Many Requests", errcode, headers=headers)