aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2024-07-27 22:28:52 +0200
committerGitHub <noreply@github.com>2024-07-27 22:28:52 +0200
commita2e56dccb0a6c525e1634ec35be5c8ff703cb70d (patch)
tree077dd7b9a07b104d68ff3036add09c7aefc1ec72
parent38549e649ed873257ca958beff272bf3f38288f8 (diff)
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]
-rw-r--r--federationapi/storage/cache/keydb.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/federationapi/storage/cache/keydb.go b/federationapi/storage/cache/keydb.go
index b53695ca..d63c889d 100644
--- a/federationapi/storage/cache/keydb.go
+++ b/federationapi/storage/cache/keydb.go
@@ -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