Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions builtin-functions/kphp-light/stdlib/rpc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ function fetch_byte () ::: int;
/** @kphp-extern-func-info can_throw */
function fetch_long () ::: int;

/** @kphp-extern-func-info can_throw */
function fetch_float () ::: float;

/** @kphp-extern-func-info can_throw */
function fetch_double () ::: float;

Expand Down
1 change: 1 addition & 0 deletions builtin-functions/kphp-light/stdlib/vkext-functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function vk_whitespace_pack ($str ::: string, $html_opt ::: bool = false) ::: st

function vk_sp_full_simplify ($str ::: string) ::: string;

/** @kphp-extern-func-info can_throw */
function vk_json_encode_safe ($v ::: mixed) ::: string;

function vk_stats_hll_merge($str ::: mixed) ::: string | false;
Expand Down
3 changes: 2 additions & 1 deletion runtime-light/stdlib/fork/fork-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "runtime-light/coroutine/shared-task.h"
#include "runtime-light/coroutine/task.h"
#include "runtime-light/coroutine/type-traits.h"
#include "runtime-light/stdlib/diagnostics/exception-functions.h"
#include "runtime-light/stdlib/diagnostics/logs.h"
#include "runtime-light/stdlib/fork/fork-state.h"
#include "runtime-light/stdlib/fork/fork-storage.h"
Expand Down Expand Up @@ -145,7 +146,7 @@ template<typename T>
kphp::coro::task<T> f$wait_multi(array<int64_t> fork_ids) noexcept {
T res{};
for (const auto& it : std::as_const(fork_ids)) {
res.set_value(it.get_key(), co_await f$wait<typename T::value_type>(it.get_value()));
res.set_value(it.get_key(), TRY_CALL_CORO(typename T::value_type, T, co_await f$wait<typename T::value_type>(it.get_value())));
}
co_return std::move(res);
}
Expand Down
16 changes: 12 additions & 4 deletions runtime-light/stdlib/rpc/rpc-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,12 @@ kphp::coro::task<array<mixed>> rpc_tl_query_result_one_impl(int64_t query_id) no
const auto it_response_fetcher{rpc_client_instance_st.response_fetcher_instances.find(query_id)};
const auto it_fork_task{rpc_client_instance_st.response_awaiter_tasks.find(query_id)};
const vk::final_action finalizer{[&rpc_client_instance_st, it_response_fetcher, it_fork_task] noexcept {
rpc_client_instance_st.response_fetcher_instances.erase(it_response_fetcher);
rpc_client_instance_st.response_awaiter_tasks.erase(it_fork_task);
if (it_response_fetcher != rpc_client_instance_st.response_fetcher_instances.end()) [[likely]] {
rpc_client_instance_st.response_fetcher_instances.erase(it_response_fetcher);
}
if (it_fork_task != rpc_client_instance_st.response_awaiter_tasks.end()) [[likely]] {
rpc_client_instance_st.response_awaiter_tasks.erase(it_fork_task);
}
}};

if (it_response_fetcher == rpc_client_instance_st.response_fetcher_instances.end() || it_fork_task == rpc_client_instance_st.response_awaiter_tasks.end())
Expand Down Expand Up @@ -236,8 +240,12 @@ kphp::coro::task<class_instance<C$VK$TL$RpcResponse>> typed_rpc_tl_query_result_
const auto it_response_fetcher{rpc_client_instance_st.response_fetcher_instances.find(query_id)};
const auto it_fork_task{rpc_client_instance_st.response_awaiter_tasks.find(query_id)};
const vk::final_action finalizer{[&rpc_client_instance_st, it_response_fetcher, it_fork_task] noexcept {
rpc_client_instance_st.response_fetcher_instances.erase(it_response_fetcher);
rpc_client_instance_st.response_awaiter_tasks.erase(it_fork_task);
if (it_response_fetcher != rpc_client_instance_st.response_fetcher_instances.end()) [[likely]] {
rpc_client_instance_st.response_fetcher_instances.erase(it_response_fetcher);
}
if (it_fork_task != rpc_client_instance_st.response_awaiter_tasks.end()) [[likely]] {
rpc_client_instance_st.response_awaiter_tasks.erase(it_fork_task);
}
}};

if (it_response_fetcher == rpc_client_instance_st.response_fetcher_instances.end() || it_fork_task == rpc_client_instance_st.response_awaiter_tasks.end())
Expand Down
Loading