| 236 | } |
| 237 | |
| 238 | int RemoteBCL::checkForMeasureUpdates() { |
| 239 | m_measuresWithUpdates.clear(); |
| 240 | |
| 241 | for (const BCLMeasure& measure : LocalBCL::instance().measures()) { |
| 242 | // can't start another request until last one is done |
| 243 | if (m_httpResponse && !m_httpResponse->is_done()) { |
| 244 | return 0; |
| 245 | } |
| 246 | |
| 247 | m_lastSearch.clear(); |
| 248 | |
| 249 | auto client = getClient(remoteUrl(), m_timeOutSeconds); |
| 250 | web::uri_builder builder(to_string_t("/api/search/")); |
| 251 | |
| 252 | builder.append_path(to_string_t("*.xml")); |
| 253 | |
| 254 | builder.append_query(to_string_t("fq[]"), to_string_t("ss_uuid:" + measure.uid())); |
| 255 | |
| 256 | builder.append_query(to_string_t("api_version"), to_string_t(m_apiVersion)); |
| 257 | |
| 258 | // LOG(Debug, m_remoteUrl << builder.to_string()); |
| 259 | |
| 260 | m_httpResponse = client.request(web::http::methods::GET, builder.to_string()) |
| 261 | .then([](web::http::http_response resp) { return resp.extract_utf8string(); }) |
| 262 | .then([this](const std::string& xml) { |
| 263 | auto remoteQueryResponse = processReply(xml); |
| 264 | |
| 265 | if (remoteQueryResponse) { |
| 266 | m_lastSearch = processSearchResponse(*remoteQueryResponse); |
| 267 | } |
| 268 | }); |
| 269 | |
| 270 | std::vector<BCLSearchResult> result = waitForSearch(); |
| 271 | if (!result.empty() && result[0].versionId() != measure.versionId()) { |
| 272 | m_measuresWithUpdates.push_back(result[0]); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | return m_measuresWithUpdates.size(); |
| 277 | } |
| 278 | |
| 279 | std::vector<BCLSearchResult> RemoteBCL::componentsWithUpdates() const { |
| 280 | return m_componentsWithUpdates; |