mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-12-26 17:36:20 +00:00
Don't bother hitting the DB if we got everything from cache (#3376)
Yet another finding where we hit the DB with a useless query. [skip ci]
This commit is contained in:
parent
38549e649e
commit
a2e56dccb0
4
federationapi/storage/cache/keydb.go
vendored
4
federationapi/storage/cache/keydb.go
vendored
|
@ -46,6 +46,10 @@ func (d *KeyDatabase) FetchKeys(
|
|||
delete(requests, req)
|
||||
}
|
||||
}
|
||||
// Don't bother hitting the DB if we got everything from cache.
|
||||
if len(requests) == 0 {
|
||||
return results, nil
|
||||
}
|
||||
fromDB, err := d.inner.FetchKeys(ctx, requests)
|
||||
if err != nil {
|
||||
return results, err
|
||||
|
|
Loading…
Reference in a new issue