CR feedback
This commit is contained in:
1 parent
d12200e977
commit
ce0beafac3
2 files changed
+8
-8
No files matched your search
@@ -144,14 +144,14 @@ int32_t rpc_connect_timeout_ms() {
|
||||
static int32_t t = config::get<config::RPCConfig>().rpc_connect_timeout_seconds() * 1000;
|
||||
return t;
|
||||
}
|
||||
void api_client_send_internal(ApiClient* pclient, qbus::RPCRequest&& request, raw_response_callback cb, int32_t accumulated_delay, void* extra) {
|
||||
void api_client_send_internal(ApiClient* pclient, qbus::RPCRequest&& request, raw_response_callback cb, int32_t delay, void* extra) {
|
||||
bts_assert(pclient);
|
||||
bool connected = pclient->rpc.wait_until_connected(0); //accumulated_delay ? 0 : 1);
|
||||
if (!connected && accumulated_delay < rpc_connect_timeout_ms()) {
|
||||
bool connected = pclient->rpc.wait_until_connected(0);
|
||||
if (!connected && delay > 0) {
|
||||
// This branch is the uncommon 'slow path' where connection is taking longer than we expect
|
||||
LOG(Api,Diag,"rpc call delay waiting for connection {}",((int64_t)request.value().c_str()));
|
||||
pclient->qbus.post([=, request{std::move(request)}]() mutable {
|
||||
api_client_send_internal(pclient, std::move(request), cb, accumulated_delay + 100, extra);
|
||||
api_client_send_internal(pclient, std::move(request), cb, delay - 100, extra);
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ CAPI void api_client_send(ApiClient* pclient, const char* buffer, int buffer_len
|
||||
LOG(Api,Diag,"send rpc {}",((int64_t)buffer));
|
||||
std::string strbuf(buffer, buffer_length);
|
||||
qbus::RPCRequest request(move(strbuf));
|
||||
api_client_send_internal(pclient, std::move(request), cb, 0, extra);
|
||||
api_client_send_internal(pclient, std::move(request), cb, rpc_connect_timeout_ms(), extra);
|
||||
}
|
||||
|
||||
CAPI bool api_client_is_on_qb_thread(ApiClient* pclient) {
|
||||
|
||||
Reference in new issue
Block a user