Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

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

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions federationapi/storage/cache/keydb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading