MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / finish_request

Method finish_request

runners/client/ClientRunningRequest.cpp:217–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217void ClientRunningRequest::finish_request(bool is_success,
218 ton::tl_object_ptr<cocoon_api::client_queryFinalInfo> final_info) {
219 if (payload_completed_) {
220 LOG(ERROR) << "client request " << request_id_.to_hex() << ": duplicate last payload part";
221 return;
222 }
223 CHECK(answer_sent_);
224 LOG(INFO) << "client request " << request_id_.to_hex() << ": completed: success=" << (is_success ? "YES" : "NO")
225 << " time=" << run_time() << " payload_parts=" << payload_parts_ << " payload_bytes=" << payload_bytes_;
226 if (is_success) {
227 stats()->requests_success++;
228 } else {
229 stats()->requests_failed++;
230 }
231 stats()->total_requests_time += run_time();
232 if (final_info) {
233 stats()->total_worker_requests_time += (final_info->worker_end_time_ - final_info->worker_start_time_);
234 stats()->total_proxy_requests_time += (final_info->proxy_end_time_ - final_info->proxy_start_time_);
235 } else {
236 stats()->total_worker_requests_time += run_time();
237 stats()->total_proxy_requests_time += run_time();
238 }
239
240 callback_->receive_payload_part("", true);
241 payload_completed_ = true;
242
243 td::actor::send_closure(client_runner_, &ClientRunner::finish_request, request_id_, proxy_);
244
245 stop();
246}
247
248const std::shared_ptr<ClientStats> ClientRunningRequest::stats() const {
249 return client_runner_.get_actor_unsafe().stats();

Callers

nothing calls this directly

Calls 1

receive_payload_partMethod · 0.45

Tested by

no test coverage detected