Compare commits

...

1 commit

Author SHA1 Message Date
Till Faelligen 7b7a176c68
Don't bother hitting the DB if we got everything from cache. 2024-05-16 19:55:21 +02:00

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