File tree 2 files changed +7
-1
lines changed
matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/pushrules
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change
1
+ Big messages taking inappropriately long to evaluate .m.rule.roomnotif push rules
Original file line number Diff line number Diff line change @@ -56,7 +56,12 @@ class EventMatchCondition(
56
56
if (wordsOnly) {
57
57
value.caseInsensitiveFind(pattern)
58
58
} else {
59
- val modPattern = if (pattern.hasSpecialGlobChar()) pattern.simpleGlobToRegExp() else " *$pattern *" .simpleGlobToRegExp()
59
+ val modPattern = if (pattern.hasSpecialGlobChar())
60
+ // Regex.containsMatchIn() is way faster without leading and trailing
61
+ // stars, that don't make any difference for the evaluation result
62
+ pattern.removePrefix(" *" ).removeSuffix(" *" ).simpleGlobToRegExp()
63
+ else
64
+ pattern.simpleGlobToRegExp()
60
65
val regex = Regex (modPattern, RegexOption .DOT_MATCHES_ALL )
61
66
regex.containsMatchIn(value)
62
67
}
You can’t perform that action at this time.
0 commit comments