Fix QueryKeys ordering

This commit is contained in:
Neil Alexander 2021-07-28 16:09:24 +01:00
parent 351ac51691
commit 64647a4f87
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -220,6 +220,12 @@ func (a *KeyInternalAPI) QueryDeviceMessages(ctx context.Context, req *api.Query
}
func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysRequest, res *api.QueryKeysResponse) {
// get cross-signing keys from the database
if err := a.crossSigningKeys(ctx, req, res); err != nil {
// TODO: handle this
util.GetLogger(ctx).WithError(err).Error("Failed to retrieve cross-signing keys")
}
res.DeviceKeys = make(map[string]map[string]json.RawMessage)
res.Failures = make(map[string]interface{})
// make a map from domain to device keys
@ -282,12 +288,6 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques
return // nothing to query
}
// get cross-signing keys from the database
if err := a.crossSigningKeys(ctx, req, res); err != nil {
// TODO: handle this
util.GetLogger(ctx).WithError(err).Error("Failed to retrieve cross-signing keys")
}
// perform key queries for remote devices
a.queryRemoteKeys(ctx, req.Timeout, res, domainToDeviceKeys)
}