hicli/pushrules: skip evaluating non-message events in initial sync

This commit is contained in:
Tulir Asokan 2024-10-20 12:52:37 +03:00
parent 251c91490c
commit 0b59b2c733

View file

@ -92,6 +92,10 @@ var (
) )
func (h *HiClient) evaluatePushRules(ctx context.Context, llSummary *mautrix.LazyLoadSummary, baseType database.UnreadType, evt *event.Event) database.UnreadType { func (h *HiClient) evaluatePushRules(ctx context.Context, llSummary *mautrix.LazyLoadSummary, baseType database.UnreadType, evt *event.Event) database.UnreadType {
if !h.firstSyncReceived && baseType == database.UnreadTypeNone {
// Skip evaluating push rules that are unlikely to match for the initial sync
return baseType
}
should := h.PushRules.Load().GetMatchingRule(&pushRoom{ should := h.PushRules.Load().GetMatchingRule(&pushRoom{
ctx: ctx, ctx: ctx,
roomID: evt.RoomID, roomID: evt.RoomID,