From 301a418e225ad474d9f4e54a9ccb91d2d5ae10cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:09:24 +0100 Subject: [PATCH] Limit max number of queued blocks from ascending bootstrap --- nano/node/bootstrap_ascending/service.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nano/node/bootstrap_ascending/service.cpp b/nano/node/bootstrap_ascending/service.cpp index 28c7410b..06e9975c 100644 --- a/nano/node/bootstrap_ascending/service.cpp +++ b/nano/node/bootstrap_ascending/service.cpp @@ -194,9 +194,9 @@ void nano::bootstrap_ascending::service::inspect (store::transaction const & tx, void nano::bootstrap_ascending::service::wait_blockprocessor () { nano::unique_lock lock{ mutex }; - while (!stopped && block_processor.half_full ()) + while (!stopped && block_processor.size () > 1000) { - condition.wait_for (lock, 500ms, [this] () { return stopped; }); // Blockprocessor is relatively slow, sleeping here instead of using conditions + condition.wait_for (lock, std::chrono::milliseconds{ config.bootstrap_ascending.throttle_wait }, [this] () { return stopped; }); // Blockprocessor is relatively slow, sleeping here instead of using conditions } } @@ -206,7 +206,7 @@ std::shared_ptr nano::bootstrap_ascending::service::wa nano::unique_lock lock{ mutex }; while (!stopped && !(channel = scoring.channel ())) { - condition.wait_for (lock, 100ms, [this] () { return stopped; }); + condition.wait_for (lock, std::chrono::milliseconds{ config.bootstrap_ascending.throttle_wait }, [this] () { return stopped; }); } return channel; }