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:
Till 2024-07-27 22:28:52 +02:00 committed by GitHub
parent 38549e649e
commit a2e56dccb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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