diff --git a/federationapi/storage/shared/storage.go b/federationapi/storage/shared/storage.go index d174f0074..eecdc8ecf 100644 --- a/federationapi/storage/shared/storage.go +++ b/federationapi/storage/shared/storage.go @@ -82,7 +82,9 @@ func (d *Database) UpdateRoom( return err } } - + if err = d.FederationJoinedHosts.DeleteJoinedHosts(ctx, txn, removeHosts); err != nil { + return err + } for _, add := range addHosts { err = d.FederationJoinedHosts.InsertJoinedHosts(ctx, txn, roomID, add.MemberEventID, add.ServerName) if err != nil { @@ -90,9 +92,6 @@ func (d *Database) UpdateRoom( } joinedHosts = append(joinedHosts, add) } - if err = d.FederationJoinedHosts.DeleteJoinedHosts(ctx, txn, removeHosts); err != nil { - return err - } return nil }) return