mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Fix bugs in resolve-state
tool
This commit is contained in:
parent
fb52b6cedc
commit
9f8b3136b2
1 changed files with 11 additions and 12 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/internal/caching"
|
"github.com/matrix-org/dendrite/internal/caching"
|
||||||
|
"github.com/matrix-org/dendrite/roomserver/state"
|
||||||
"github.com/matrix-org/dendrite/roomserver/storage"
|
"github.com/matrix-org/dendrite/roomserver/storage"
|
||||||
"github.com/matrix-org/dendrite/roomserver/types"
|
"github.com/matrix-org/dendrite/roomserver/types"
|
||||||
"github.com/matrix-org/dendrite/setup"
|
"github.com/matrix-org/dendrite/setup"
|
||||||
|
@ -59,25 +60,23 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
blockNIDs, err := roomserverDB.StateBlockNIDs(ctx, snapshotNIDs)
|
stateres := state.NewStateResolution(roomserverDB, &types.RoomInfo{
|
||||||
if err != nil {
|
RoomVersion: gomatrixserverlib.RoomVersion(*roomVersion),
|
||||||
panic(err)
|
})
|
||||||
}
|
|
||||||
|
|
||||||
var stateEntries []types.StateEntryList
|
var stateEntries []types.StateEntry
|
||||||
for _, list := range blockNIDs {
|
for _, snapshotNID := range snapshotNIDs {
|
||||||
entries, err2 := roomserverDB.StateEntries(ctx, list.StateBlockNIDs)
|
var entries []types.StateEntry
|
||||||
if err2 != nil {
|
entries, err = stateres.LoadStateAtSnapshot(ctx, snapshotNID)
|
||||||
panic(err2)
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
}
|
}
|
||||||
stateEntries = append(stateEntries, entries...)
|
stateEntries = append(stateEntries, entries...)
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventNIDs []types.EventNID
|
var eventNIDs []types.EventNID
|
||||||
for _, entry := range stateEntries {
|
for _, entry := range stateEntries {
|
||||||
for _, e := range entry.StateEntries {
|
eventNIDs = append(eventNIDs, entry.EventNID)
|
||||||
eventNIDs = append(eventNIDs, e.EventNID)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Fetching", len(eventNIDs), "state events")
|
fmt.Println("Fetching", len(eventNIDs), "state events")
|
||||||
|
|
Loading…
Reference in a new issue