From 4a868f16873a374823387d5c905aca61e42b137d Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Wed, 8 Mar 2023 13:42:55 +0100 Subject: [PATCH] Always try to get a roomInfo, avoid empty roomVersion? --- roomserver/internal/input/input_events.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index d709541be..9b1cc340e 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -333,11 +333,9 @@ func (r *Inputer) processRoomEvent( } } - if roomInfo == nil { - roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, event) - if err != nil { - return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err) - } + roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, event) + if err != nil { + return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err) } eventTypeNID, err := r.DB.GetOrCreateEventTypeNID(ctx, event.Type()) @@ -704,11 +702,9 @@ nextAuthEvent: logger.WithError(err).Warnf("Auth event %s rejected", authEvent.EventID()) } - if roomInfo == nil { - roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, authEvent) - if err != nil { - return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err) - } + roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, authEvent) + if err != nil { + return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err) } eventTypeNID, err := r.DB.GetOrCreateEventTypeNID(ctx, authEvent.Type())