Always try to get a roomInfo, avoid empty roomVersion?

This commit is contained in:
Till Faelligen 2023-03-08 13:42:55 +01:00
parent baef523cb0
commit 4a868f1687
No known key found for this signature in database
GPG key ID: ACCDC9606D472758

View file

@ -333,11 +333,9 @@ func (r *Inputer) processRoomEvent(
} }
} }
if roomInfo == nil { roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, event)
roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, event) if err != nil {
if err != nil { return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err)
return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err)
}
} }
eventTypeNID, err := r.DB.GetOrCreateEventTypeNID(ctx, event.Type()) eventTypeNID, err := r.DB.GetOrCreateEventTypeNID(ctx, event.Type())
@ -704,11 +702,9 @@ nextAuthEvent:
logger.WithError(err).Warnf("Auth event %s rejected", authEvent.EventID()) logger.WithError(err).Warnf("Auth event %s rejected", authEvent.EventID())
} }
if roomInfo == nil { roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, authEvent)
roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, authEvent) if err != nil {
if err != nil { return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err)
return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err)
}
} }
eventTypeNID, err := r.DB.GetOrCreateEventTypeNID(ctx, authEvent.Type()) eventTypeNID, err := r.DB.GetOrCreateEventTypeNID(ctx, authEvent.Type())