mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-17 13:34:23 -05:00
Fix breaking event sending due to bad push rule (#13547)
Broke by #13522 It looks like we have some rules in the DB with a priority class less than 0 that don't override the base rules. Before these were just dropped, but #13522 made that a hard error.
This commit is contained in:
parent
ba8938b090
commit
436e0eb39a
1
changelog.d/13547.misc
Normal file
1
changelog.d/13547.misc
Normal file
@ -0,0 +1 @@
|
||||
Improve performance of sending messages in rooms with thousands of local users.
|
@ -49,6 +49,7 @@ kind, etc, etc.
|
||||
"""
|
||||
|
||||
import itertools
|
||||
import logging
|
||||
from typing import Dict, Iterator, List, Mapping, Sequence, Tuple, Union
|
||||
|
||||
import attr
|
||||
@ -56,6 +57,8 @@ import attr
|
||||
from synapse.config.experimental import ExperimentalConfig
|
||||
from synapse.push.rulekinds import PRIORITY_CLASS_MAP
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True, slots=True, frozen=True)
|
||||
class PushRule:
|
||||
@ -199,8 +202,16 @@ def compile_push_rules(rawrules: List[PushRule]) -> PushRules:
|
||||
collection = rules.sender
|
||||
elif rule.priority_class == 1:
|
||||
collection = rules.underride
|
||||
elif rule.priority_class <= 0:
|
||||
logger.info(
|
||||
"Got rule with priority class less than zero, but doesn't override a base rule: %s",
|
||||
rule,
|
||||
)
|
||||
continue
|
||||
else:
|
||||
raise Exception(f"Unknown priority class: {rule.priority_class}")
|
||||
# We log and continue here so as not to break event sending
|
||||
logger.error("Unknown priority class: %", rule.priority_class)
|
||||
continue
|
||||
|
||||
collection.append(rule)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user