mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 06:43:09 -06:00
Fix state block retrieval
This commit is contained in:
parent
db5a99e82b
commit
1cea9f7a1c
|
|
@ -182,14 +182,15 @@ func (d *Database) StateForRoomID(
|
||||||
// the room doesn't exist or it doesn't have state
|
// the room doesn't exist or it doesn't have state
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
stateBlockNIDs, err := d.StateSnapshotTable.BulkSelectStateBlockNIDs(ctx, []types.StateSnapshotNID{stateSnapshotNID})
|
stateBlockLists, err := d.StateSnapshotTable.BulkSelectStateBlockNIDs(ctx, []types.StateSnapshotNID{stateSnapshotNID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("d.StateSnapshotTable.BulkSelectStateBlockNIDs: %w", err)
|
return nil, fmt.Errorf("d.StateSnapshotTable.BulkSelectStateBlockNIDs: %w", err)
|
||||||
}
|
}
|
||||||
if len(stateBlockNIDs) != 1 {
|
stateBlockNIDs := []types.StateBlockNID{}
|
||||||
return nil, fmt.Errorf("expected one StateBlockNIDList, got %d", len(stateBlockNIDs))
|
for _, stateBlockList := range stateBlockLists {
|
||||||
|
stateBlockNIDs = append(stateBlockNIDs, stateBlockList.StateBlockNIDs...)
|
||||||
}
|
}
|
||||||
stateEventLists, err := d.StateBlockTable.BulkSelectStateBlockEntries(ctx, stateBlockNIDs[0].StateBlockNIDs)
|
stateEventLists, err := d.StateBlockTable.BulkSelectStateBlockEntries(ctx, stateBlockNIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("d.StateBlockTable.BulkSelectStateBlockEntries: %w", err)
|
return nil, fmt.Errorf("d.StateBlockTable.BulkSelectStateBlockEntries: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue