This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
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.
Fix some comments and types in service notices #7996
Fix some comments and types in service notices #7996
Changes from 4 commits
dd1fbb2
4a3f15d
a9d97d8
699eb37
052a474
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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'm not sure if I see much evidence of
event_limit_type
ever being set toNone
by the calling function?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.
synapse/synapse/server_notices/resource_limits_server_notices.py
Lines 88 to 97 in 4a3f15d
limit_type
only gets set on error.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 should also note that mypy found this.)
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 looks like in the linked code block that
_apply_limit_block_notification
will only be called iflimit_msg
is notNone
, and aslimit_msg
andlimit_type
are both set together,_apply_limit_block_notification
should only be called whenlimit_type
is notNone
?I suppose that may just be circumstantial of this one calling function though, and
_apply_limit_block_notification
can handlelimit_type=None
just fine, and thus that's what the signature should be. I found it a bit difficult to verify that last bit though...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.
Ah, I see what you're saying. Let me see if I can convince mypy here...
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.
Yeah so mypy doesn't seem to recognize that these are both set or neither is set. I switched it around a bit in 052a474, but ended up ignoring that function call. I believe the correct signature is
str
, notOptional[str]
, so I'd rather the signature be correct.Let me know if you agree!