mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-22 22:31:56 -06:00
Another joined hosts fix
This commit is contained in:
parent
f06dd56df6
commit
8e2eeb76a9
|
@ -69,6 +69,7 @@ func (d *Database) UpdateRoom(
|
||||||
purgeRoomFirst bool,
|
purgeRoomFirst bool,
|
||||||
) (joinedHosts []types.JoinedHost, err error) {
|
) (joinedHosts []types.JoinedHost, err error) {
|
||||||
err = d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
err = d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||||
|
var joinedHosts []types.JoinedHost
|
||||||
if purgeRoomFirst {
|
if purgeRoomFirst {
|
||||||
// If the event is a create event then we'll delete all of the existing
|
// If the event is a create event then we'll delete all of the existing
|
||||||
// data for the room. The only reason that a create event would be replayed
|
// data for the room. The only reason that a create event would be replayed
|
||||||
|
@ -76,12 +77,11 @@ func (d *Database) UpdateRoom(
|
||||||
if err = d.FederationJoinedHosts.DeleteJoinedHostsForRoom(ctx, txn, roomID); err != nil {
|
if err = d.FederationJoinedHosts.DeleteJoinedHostsForRoom(ctx, txn, roomID); err != nil {
|
||||||
return fmt.Errorf("d.FederationJoinedHosts.DeleteJoinedHosts: %w", err)
|
return fmt.Errorf("d.FederationJoinedHosts.DeleteJoinedHosts: %w", err)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
if joinedHosts, err = d.FederationJoinedHosts.SelectJoinedHostsWithTx(ctx, txn, roomID); err != nil {
|
||||||
joinedHosts, err = d.FederationJoinedHosts.SelectJoinedHostsWithTx(ctx, txn, roomID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, add := range addHosts {
|
for _, add := range addHosts {
|
||||||
err = d.FederationJoinedHosts.InsertJoinedHosts(ctx, txn, roomID, add.MemberEventID, add.ServerName)
|
err = d.FederationJoinedHosts.InsertJoinedHosts(ctx, txn, roomID, add.MemberEventID, add.ServerName)
|
||||||
|
|
Loading…
Reference in a new issue