Skip to content

Commit 510924a

Browse files
Add missing await to sleep calls (#18763)
1 parent 3b5b6f6 commit 510924a

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

changelog.d/18763.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix an issue that could cause logcontexts to be lost on rate-limited requests. Found by @realtyem.

synapse/http/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ async def _async_render_wrapper(self, request: "SynapseRequest") -> None:
337337
callback_return = await self._async_render(request)
338338
except LimitExceededError as e:
339339
if e.pause:
340-
self._clock.sleep(e.pause)
340+
await self._clock.sleep(e.pause)
341341
raise
342342

343343
if callback_return is not None:

synapse/storage/databases/main/deviceinbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ def _delete_old_federation_inbox_rows_txn(txn: LoggingTransaction) -> bool:
10311031

10321032
# We sleep a bit so that we don't hammer the database in a tight
10331033
# loop first time we run this.
1034-
self._clock.sleep(1)
1034+
await self._clock.sleep(1)
10351035

10361036
async def get_devices_with_messages(
10371037
self, user_id: str, device_ids: StrCollection

0 commit comments

Comments
 (0)