mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03: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
1 changed files with 4 additions and 0 deletions
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)
|
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)
|
fromDB, err := d.inner.FetchKeys(ctx, requests)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return results, err
|
return results, err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue