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

Commit

Permalink
Don't bother hitting the DB if we got everything from cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
S7evinK committed May 16, 2024
1 parent 46902e5 commit 7b7a176
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit 7b7a176

Please sign in to comment.