Try harder to query remote keys

This commit is contained in:
Neil Alexander 2021-07-30 09:58:03 +01:00
parent d459ef5b16
commit 5a00ff3634
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -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
}