Don't bother hitting the DB if we got everything from cache.

This commit is contained in:
Till Faelligen 2024-05-16 19:53:22 +02:00
parent 46902e5766
commit 7b7a176c68
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

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