mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-08 18:16:59 +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 New Issue
Block a user