mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 22:03:10 -06:00
Don't hit cache twice in RoomNIDExcludingStubs
This commit is contained in:
parent
5d2e6abff9
commit
63c0b4c336
|
|
@ -209,14 +209,10 @@ func (d *Database) RoomNID(ctx context.Context, roomID string) (types.RoomNID, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) RoomNIDExcludingStubs(ctx context.Context, roomID string) (roomNID types.RoomNID, err error) {
|
func (d *Database) RoomNIDExcludingStubs(ctx context.Context, roomID string) (roomNID types.RoomNID, err error) {
|
||||||
if nid, ok := d.Cache.GetRoomServerRoomNID(roomID); ok {
|
|
||||||
roomNID = nid
|
|
||||||
} else {
|
|
||||||
roomNID, err = d.RoomNID(ctx, roomID)
|
roomNID, err = d.RoomNID(ctx, roomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
latestEvents, _, err := d.RoomsTable.SelectLatestEventNIDs(ctx, nil, roomNID)
|
latestEvents, _, err := d.RoomsTable.SelectLatestEventNIDs(ctx, nil, roomNID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue