mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
parent
5b969d172b
commit
b99f594a93
1 changed files with 8 additions and 1 deletions
|
@ -165,14 +165,21 @@ func (d *Database) AddState(
|
||||||
if berr != nil {
|
if berr != nil {
|
||||||
return 0, fmt.Errorf("d.StateBlockTable.BulkSelectStateBlockEntries: %w", berr)
|
return 0, fmt.Errorf("d.StateBlockTable.BulkSelectStateBlockEntries: %w", berr)
|
||||||
}
|
}
|
||||||
|
var found bool
|
||||||
for i := len(state) - 1; i >= 0; i-- {
|
for i := len(state) - 1; i >= 0; i-- {
|
||||||
|
found = false
|
||||||
for _, events := range blocks {
|
for _, events := range blocks {
|
||||||
for _, event := range events {
|
for _, event := range events {
|
||||||
if state[i].EventNID == event {
|
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 {
|
err = d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||||
|
|
Loading…
Reference in a new issue