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,13 +209,9 @@ 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) {
|
||||
if nid, ok := d.Cache.GetRoomServerRoomNID(roomID); ok {
|
||||
roomNID = nid
|
||||
} else {
|
||||
roomNID, err = d.RoomNID(ctx, roomID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
roomNID, err = d.RoomNID(ctx, roomID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
latestEvents, _, err := d.RoomsTable.SelectLatestEventNIDs(ctx, nil, roomNID)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue