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

Method finish

runners/proxy/ProxyRunningRequest.cpp:233–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233void ProxyRunningRequest::finish(bool is_success) {
234 CHECK(tokens_used_);
235 LOG(INFO) << "proxy request " << id_.to_hex() << ": completed: success=" << (is_success ? "YES" : "NO")
236 << " time=" << run_time() << " payload_parts=" << payload_parts_ << " payload_bytes=" << payload_bytes_
237 << " tokens_used=" << tokens_used_->prompt_tokens_used_ << "+" << tokens_used_->cached_tokens_used_ << "+"
238 << tokens_used_->completion_tokens_used_ << "+" << tokens_used_->reasoning_tokens_used_ << "="
239 << tokens_used_->total_tokens_used_;
240 if (is_success) {
241 stats()->requests_success++;
242 } else {
243 stats()->requests_failed++;
244 }
245
246 auto work_time = run_time();
247 stats_->total_requests_time += work_time;
248 stats_->total_worker_requests_time += worker_run_time_;
249
250 td::actor::send_closure(runner_, &ProxyRunner::finish_request, id_, client_request_id_, client_,
251 client_connection_id_, worker_->info, worker_, std::move(tokens_used_), reserved_tokens_,
252 is_success, work_time, worker_run_time_);
253 stop();
254}
255
256std::string ProxyRunningRequest::generate_proxy_debug_inner() {
257 nlohmann::json v;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected