Add missing await to sleep calls (#18763)

This commit is contained in:
Andrew Morgan 2025-08-01 16:00:30 +01:00 committed by GitHub
parent 3b5b6f6152
commit 510924a2f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

1
changelog.d/18763.bugfix Normal file
View File

@ -0,0 +1 @@
Fix an issue that could cause logcontexts to be lost on rate-limited requests. Found by @realtyem.

View File

@ -337,7 +337,7 @@ class _AsyncResource(resource.Resource, metaclass=abc.ABCMeta):
callback_return = await self._async_render(request)
except LimitExceededError as e:
if e.pause:
self._clock.sleep(e.pause)
await self._clock.sleep(e.pause)
raise
if callback_return is not None:

View File

@ -1031,7 +1031,7 @@ class DeviceInboxWorkerStore(SQLBaseStore):
# We sleep a bit so that we don't hammer the database in a tight
# loop first time we run this.
self._clock.sleep(1)
await self._clock.sleep(1)
async def get_devices_with_messages(
self, user_id: str, device_ids: StrCollection