-
Notifications
You must be signed in to change notification settings - Fork 414
Fix run_in_background not be awaited properly causing LoggingContext problems
#18937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MadLittleMods
merged 7 commits into
develop
from
madlittlemods/run_in_background_logcontext_problems
Sep 22, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c582067
Manually fix logcontexts in test
MadLittleMods a355439
Revert "Manually fix logcontexts in test"
MadLittleMods 589c518
Add a default log context for anything running with `get_success(...)`
MadLittleMods 77f52e9
Revert "Add a default log context for anything running with `get_succ…
MadLittleMods fc5bded
No need for `run_in_background` or `LoggingContext` in `test_federation`
MadLittleMods 29a657f
Add changelog
MadLittleMods 8fcfe29
Merge branch 'develop' into madlittlemods/run_in_background_logcontex…
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix `run_in_background` not be awaited properly in some tests causing `LoggingContext` problems. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally tried adapting things to keep these
LoggingContextaround but then realized there is no point in having these here in the tests.The only reason I can see why this might have been added was to avoid these kind of warnings in
_trial_temp/test.log:But it's expected that test things run outside of Synapse and by their nature should happen in the
sentinellogcontext. And if we really don't want to see these kind of errors, we would need to refactorget_success(...)to look more likeget_success(func, OTHER_SERVER, ev)where we call the function with somehomeserver_test_caselogcontext instead of passing in an awaitable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible the name was added here for logging clarity, to be fair?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that was the original reason but with a more nailed down definition of
sentinellogcontext and when it should be used, I don't think it makes sense.And after working with logcontext a bunch, I've kinda come to the conclusion that the name doesn't matter much outside of a request. Or at-least doesn't matter much to what I'm trying to accomplish.