Skip to content

Conversation

@jason-famedly
Copy link
Collaborator

Updating to Synapse v1.143 compliance

chrislearn and others added 9 commits November 4, 2025 16:19
…g#811)

Co-authored-by: Eric Eastwood <erice@element.io>
> If the returned error is nil, the [Response](https://pkg.go.dev/net/http#Response) will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the [Client](https://pkg.go.dev/net/http#Client)'s underlying [RoundTripper](https://pkg.go.dev/net/http#RoundTripper) (typically [Transport](https://pkg.go.dev/net/http#Transport)) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request.
>
> *-- https://pkg.go.dev/net/http#Client.Do*

But it also may leak resources 🤷 

See also:

 - https://blevesearch.com/news/Deferred-Cleanup,-Checking-Errors,-and-Potential-Problems/
 - https://stackoverflow.com/questions/47293975/should-i-error-check-close-on-a-response-body
 - https://manishrjain.com/must-close-golang-http-response
…atrix-org#813)

*Spawning from matrix-org#808 per my suggestion on matrix-org#808 (comment)

We have other spots that have flawed membership checks that need to be fixed. For example, when our goal is to wait for the user's membership to be `leave`, we should keep checking until it is `leave`. Currently, there are some spots that wait until *any* membership exists for the user and then asserts `leave` on that which is flawed because that user may have previous membership events that may be picked up first instead of waiting for the `leave`.

This PR fixes those flawed checks and aligns our membership checks so we don't cargo cult this bad pattern elsewhere.

 - Generalize our `client.SyncXXX` helpers to use `syncMembershipIn` utility
    - More robust
    - Standardize extra `checks` on event (previously, only available with `client.SyncJoinedTo`)
 - Introduce `client.SyncBannedFrom` so we can differentiate ban/leave
…ement-changes

Delayed event management changes
@jason-famedly jason-famedly requested a review from a team as a code owner December 16, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants