Created
October 22, 2019 11:38
-
-
Save richvdh/092934e994a2443bd184a01357c98677 to your computer and use it in GitHub Desktop.
This file contains 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
try: | |
is_auth_blocking = False | |
if self._config.mau_limit_alerting: | |
try: | |
# Normally should always pass in user_id to check_auth_blocking | |
# if you have it, but in this case are checking what would happen | |
# to other users if they were to arrive. | |
yield self._auth.check_auth_blocking() | |
except ResourceLimitError as e: | |
is_auth_blocking = True | |
event_body = e.msg | |
event_limit_type = e.limit_type | |
if currently_blocked and not is_auth_blocking: | |
# Room is notifying of a block, when it ought not to be. | |
yield self._remove_limit_block_notification(user_id, ref_events) | |
elif not currently_blocked and is_auth_blocking: | |
# Room is not notifying of a block, when it ought to be. | |
yield self._apply_limit_block_notification( | |
user_id, event_body, event_limit_type | |
) | |
except SynapseError as e: | |
logger.error("Error sending resource limits server notice: %s", e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment