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

Method http_change_worker_model

runners/proxy/ProxyRunner.cpp:1661–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1659}
1660
1661std::string ProxyRunner::http_change_worker_model(std::string worker_connection_id, std::string new_model_name) {
1662 auto R = td::to_integer_safe<td::int64>(worker_connection_id);
1663 if (R.is_error()) {
1664 return wrap_short_answer_to_http("worker_connection_id not an integer");
1665 }
1666 auto conn_id = R.move_as_ok();
1667 auto conn = get_connection(conn_id);
1668 if (!conn) {
1669 return wrap_short_answer_to_http("connection not found");
1670 }
1671 if (conn->remote_app_type() != remote_app_type_worker()) {
1672 return wrap_short_answer_to_http("connection not from worker");
1673 }
1674 auto w_conn = static_cast<ProxyInboundWorkerConnection *>(conn);
1675 if (!w_conn->handshake_is_completed()) {
1676 return wrap_short_answer_to_http("connection is not ready");
1677 }
1678 auto req = create_serialize_tl_object<cocoon_api::worker_changeModel>(new_model_name);
1679 send_query_to_connection(conn_id, "changeworkermodel", std::move(req), td::Timestamp::in(60.0), {});
1680 return wrap_short_answer_to_http("request sent");
1681}
1682
1683std::string ProxyRunner::http_generate_main() {
1684 td::StringBuilder sb;

Callers

nothing calls this directly

Calls 2

remote_app_type_workerFunction · 0.85

Tested by

no test coverage detected