mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-13 23:31:34 +00:00
Optimise resolve-state
tool
This commit is contained in:
parent
d1f87e63f1
commit
1c1d09abd4
@ -76,9 +76,14 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventNIDs []types.EventNID
|
eventNIDMap := map[types.EventNID]struct{}{}
|
||||||
for _, entry := range append(removed, added...) {
|
for _, entry := range append(removed, added...) {
|
||||||
eventNIDs = append(eventNIDs, entry.EventNID)
|
eventNIDMap[entry.EventNID] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
eventNIDs := make([]types.EventNID, 0, len(eventNIDMap))
|
||||||
|
for eventNID := range eventNIDMap {
|
||||||
|
eventNIDs = append(eventNIDs, eventNID)
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventEntries []types.Event
|
var eventEntries []types.Event
|
||||||
@ -129,12 +134,17 @@ func main() {
|
|||||||
stateEntries = append(stateEntries, entries...)
|
stateEntries = append(stateEntries, entries...)
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventNIDs []types.EventNID
|
eventNIDMap := map[types.EventNID]struct{}{}
|
||||||
for _, entry := range stateEntries {
|
for _, entry := range stateEntries {
|
||||||
eventNIDs = append(eventNIDs, entry.EventNID)
|
eventNIDMap[entry.EventNID] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Fetching", len(eventNIDs), "state events")
|
eventNIDs := make([]types.EventNID, 0, len(eventNIDMap))
|
||||||
|
for eventNID := range eventNIDMap {
|
||||||
|
eventNIDs = append(eventNIDs, eventNID)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Fetching", len(eventNIDMap), "state events")
|
||||||
eventEntries, err := roomserverDB.Events(ctx, eventNIDs)
|
eventEntries, err := roomserverDB.Events(ctx, eventNIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user