Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/18763.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix an issue that could cause logcontexts to be lost on rate-limited requests. Found by @realtyem.
2 changes: 1 addition & 1 deletion synapse/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ async def _async_render_wrapper(self, request: "SynapseRequest") -> None:
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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we can lint?

We already detect this kind of thing for async/await

error: Value of type "Coroutine[Any, Any, None]" must be used  [unused-coroutine]
note: Are you missing an await?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh mmm, we probably want to change the return type of sleep

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this here: #18772

raise

if callback_return is not None:
Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/deviceinbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ def _delete_old_federation_inbox_rows_txn(txn: LoggingTransaction) -> bool:

# 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
Expand Down
Loading