Skip to content

Commit

Permalink
Change processed blocks factor for requeued pulls (#2437)
Browse files Browse the repository at this point in the history
From `processed blocks / 10000` to `processed blocks / 4096` for better processing of largest chains in case of failures
  • Loading branch information
SergiySW authored Jan 16, 2020
1 parent 796f9f6 commit c96f4f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nano/node/bootstrap/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ constexpr double nano::bootstrap_limits::required_frontier_confirmation_ratio;
constexpr unsigned nano::bootstrap_limits::frontier_confirmation_blocks_limit;
constexpr unsigned nano::bootstrap_limits::requeued_pulls_limit;
constexpr unsigned nano::bootstrap_limits::requeued_pulls_limit_test;
constexpr unsigned nano::bootstrap_limits::requeued_pulls_processed_blocks_factor;
constexpr std::chrono::seconds nano::bootstrap_limits::lazy_flush_delay_sec;
constexpr unsigned nano::bootstrap_limits::lazy_destinations_request_limit;
constexpr uint64_t nano::bootstrap_limits::lazy_batch_pull_count_resize_blocks_limit;
Expand Down Expand Up @@ -605,7 +606,7 @@ void nano::bootstrap_attempt::requeue_pull (nano::pull_info const & pull_a, bool
++pull.attempts;
}
++requeued_pulls;
if (mode != nano::bootstrap_mode::lazy && pull.attempts < pull.retry_limit + (pull.processed / 10000))
if (mode != nano::bootstrap_mode::lazy && pull.attempts < pull.retry_limit + (pull.processed / nano::bootstrap_limits::requeued_pulls_processed_blocks_factor))
{
nano::lock_guard<std::mutex> lock (mutex);
pulls.push_front (pull);
Expand Down
1 change: 1 addition & 0 deletions nano/node/bootstrap/bootstrap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ class bootstrap_limits final
static constexpr unsigned frontier_confirmation_blocks_limit = 128 * 1024;
static constexpr unsigned requeued_pulls_limit = 256;
static constexpr unsigned requeued_pulls_limit_test = 2;
static constexpr unsigned requeued_pulls_processed_blocks_factor = 4096;
static constexpr unsigned bulk_push_cost_limit = 200;
static constexpr std::chrono::seconds lazy_flush_delay_sec = std::chrono::seconds (5);
static constexpr unsigned lazy_destinations_request_limit = 256 * 1024;
Expand Down

0 comments on commit c96f4f0

Please sign in to comment.