Skip to content

Wait for response to be sent#18850

Draft
MadLittleMods wants to merge 1 commit into
developfrom
madlittlemods/async-await-resources
Draft

Wait for response to be sent#18850
MadLittleMods wants to merge 1 commit into
developfrom
madlittlemods/async-await-resources

Conversation

@MadLittleMods
Copy link
Copy Markdown
Contributor

@MadLittleMods MadLittleMods commented Aug 20, 2025

Spawning from #18804 (comment) as mentioned by @richvdh,

[...] the goal is just to use async/await all the way up the chain so the trace_servlet doesn't close until we're finished and LoggingContext.scope sticks around until the end as expected.

But we're no longer using LoggingContext.scope since moving to OpenTracing's ContextVarsScopeManager in #18849 (reverted in #18849)

The benefit now is TODO


In terms of tracing, TODO

Before After
2025-08-20_15-50 .

Dev notes

You can see how I did the simpler implementation of async HTTP resources in https://github.com/element-hq/synapse-small-hosts/pull/313

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

Comment thread synapse/http/server.py
Python implementation (rather than the C backend), which is *much* more
expensive.

The actual writing of bytes is not finished when this returns.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Feel like we might want to copy this comment up the chain to respond_with_json and _send_response/_send_error_response

@MadLittleMods MadLittleMods added the A-Tracing OpenTracing (maybe OpenTelemetry in the future) label Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Tracing OpenTracing (maybe OpenTelemetry in the future)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant