Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Don't print HTTPStatus.* in "Processed..." logs (#11827)
Browse files Browse the repository at this point in the history
* Don't print HTTPStatus.* in "Processed..." logs

Fixes #11812. See also #7118 and
#7188 (comment) in
particular.

Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
  • Loading branch information
David Robertson and babolivier authored Jan 26, 2022
1 parent c581556 commit d8df8e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/11827.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 0.33.3 causing requests to sometimes log strings such as `HTTPStatus.OK` instead of integer status codes.
5 changes: 4 additions & 1 deletion synapse/http/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,10 @@ def _finished_processing(self) -> None:

user_agent = get_request_user_agent(self, "-")

code = str(self.code)
# int(self.code) looks redundant, because self.code is already an int.
# But self.code might be an HTTPStatus (which inherits from int)---which has
# a different string representation. So ensure we really have an integer.
code = str(int(self.code))
if not self.finished:
# we didn't send the full response before we gave up (presumably because
# the connection dropped)
Expand Down

0 comments on commit d8df8e6

Please sign in to comment.