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

Commit

Permalink
fixup: avoid tracing when rate limit is exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Quah committed Aug 18, 2022
1 parent b999888 commit b7b50a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion synapse/util/ratelimitutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ def ratelimit(self, host: str) -> "Iterator[defer.Deferred[None]]":
self._on_exit(request_id)

async def _on_enter_with_tracing(self, request_id: object) -> None:
# We may raise a `LimitExceededError`, in which case we avoid tracing.
d = self._on_enter(request_id)

with start_active_span("ratelimit wait"), queue_wait_timer.time():
await self._on_enter(request_id)
await d

def _on_enter(self, request_id: object) -> "defer.Deferred[None]":
time_now = self.clock.time_msec()
Expand Down

0 comments on commit b7b50a7

Please sign in to comment.