Do not complain when a query timeout, if replies were received
This commit is contained in:
parent
62fb8ffbd0
commit
4f2f66bbe2
3 changed files with 15 additions and 3 deletions
|
|
@ -337,6 +337,7 @@ enum class detail : uint8_t
|
||||||
query_duplicate,
|
query_duplicate,
|
||||||
rep_timeout,
|
rep_timeout,
|
||||||
query_timeout,
|
query_timeout,
|
||||||
|
query_completion,
|
||||||
crawl_aggressive,
|
crawl_aggressive,
|
||||||
crawl_normal,
|
crawl_normal,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,8 +211,16 @@ void nano::rep_crawler::cleanup ()
|
||||||
erase_if (queries, [this] (query_entry const & query) {
|
erase_if (queries, [this] (query_entry const & query) {
|
||||||
if (nano::elapsed (query.time, config.query_timeout))
|
if (nano::elapsed (query.time, config.query_timeout))
|
||||||
{
|
{
|
||||||
logger.debug (nano::log::type::rep_crawler, "Aborting unresponsive query for block {} from {}", query.hash.to_string (), query.channel->to_string ());
|
if (query.replies == 0)
|
||||||
stats.inc (nano::stat::type::rep_crawler, nano::stat::detail::query_timeout);
|
{
|
||||||
|
logger.debug (nano::log::type::rep_crawler, "Aborting unresponsive query for block {} from {}", query.hash.to_string (), query.channel->to_string ());
|
||||||
|
stats.inc (nano::stat::type::rep_crawler, nano::stat::detail::query_timeout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.debug (nano::log::type::rep_crawler, "Completion of query with {} replies for block {} from {}", query.replies, query.hash.to_string (), query.channel->to_string ());
|
||||||
|
stats.inc (nano::stat::type::rep_crawler, nano::stat::detail::query_completion);
|
||||||
|
}
|
||||||
return true; // Erase
|
return true; // Erase
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -401,7 +409,9 @@ bool nano::rep_crawler::process (std::shared_ptr<nano::vote> const & vote, std::
|
||||||
// TODO: Track query response time
|
// TODO: Track query response time
|
||||||
|
|
||||||
responses.push_back ({ channel, vote });
|
responses.push_back ({ channel, vote });
|
||||||
|
queries.modify (it, [] (query_entry & e) {
|
||||||
|
e.replies++;
|
||||||
|
});
|
||||||
condition.notify_all ();
|
condition.notify_all ();
|
||||||
return true; // Found and processed
|
return true; // Found and processed
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ private:
|
||||||
nano::block_hash hash;
|
nano::block_hash hash;
|
||||||
std::shared_ptr<nano::transport::channel> channel;
|
std::shared_ptr<nano::transport::channel> channel;
|
||||||
std::chrono::steady_clock::time_point time{ std::chrono::steady_clock::now () };
|
std::chrono::steady_clock::time_point time{ std::chrono::steady_clock::now () };
|
||||||
|
unsigned int replies{ 0 }; // number of replies to the query
|
||||||
};
|
};
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue