Don't bother hitting the DB if we got everything from cache.
This commit is contained in:
parent
46902e5766
commit
7b7a176c68
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