diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go index e3ede9ac..f6f6cbab 100644 --- a/keyserver/internal/internal.go +++ b/keyserver/internal/internal.go @@ -227,8 +227,10 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques res.Failures = make(map[string]interface{}) // get cross-signing keys from the database + crossSigningSatisfiedLocally := true if err := a.crossSigningKeys(ctx, req, res); err != nil { util.GetLogger(ctx).WithError(err).Error("Failed to retrieve cross-signing keys from database") + crossSigningSatisfiedLocally = false } // make a map from domain to device keys @@ -287,7 +289,7 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques // attempt to satisfy key queries from the local database first as we should get device updates pushed to us domainToDeviceKeys = a.remoteKeysFromDatabase(ctx, res, domainToDeviceKeys) - if len(domainToDeviceKeys) == 0 { + if len(domainToDeviceKeys) == 0 && crossSigningSatisfiedLocally { return // nothing to query }