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

Commit

Permalink
Fix breaking event sending due to bad push rule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
erikjohnston committed Aug 17, 2022
1 parent d75512d commit ac469ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions synapse/push/baserules.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@
"""

import itertools
import logging
from typing import Dict, Iterator, List, Mapping, Sequence, Tuple, Union

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:
Expand Down Expand Up @@ -199,6 +202,12 @@ 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}")

Expand Down

0 comments on commit ac469ab

Please sign in to comment.