Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Fix #2028 (#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander authored Nov 2, 2021
1 parent 5b969d1 commit b99f594
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion roomserver/storage/shared/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,21 @@ func (d *Database) AddState(
if berr != nil {
return 0, fmt.Errorf("d.StateBlockTable.BulkSelectStateBlockEntries: %w", berr)
}
var found bool
for i := len(state) - 1; i >= 0; i-- {
found = false
for _, events := range blocks {
for _, event := range events {
if state[i].EventNID == event {
state = append(state[:i], state[i+1:]...)
found = true
break
}
}
}
if found {
state = append(state[:i], state[i+1:]...)
i--
}
}
}
err = d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
Expand Down

0 comments on commit b99f594

Please sign in to comment.