From 23482f92ef859e206c8b45e3b6e51a4e58086b44 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Tue, 12 Sep 2023 13:15:29 +0100 Subject: [PATCH] Use priority limiter --- nano/node/scheduler/priority.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nano/node/scheduler/priority.cpp b/nano/node/scheduler/priority.cpp index 1bb0e2e276..6cc21d8ec4 100644 --- a/nano/node/scheduler/priority.cpp +++ b/nano/node/scheduler/priority.cpp @@ -1,5 +1,6 @@ #include #include +#include #include nano::scheduler::priority::priority (nano::node & node_a, nano::stats & stats_a) : @@ -106,11 +107,12 @@ void nano::scheduler::priority::run () if (predicate ()) { - auto block = buckets->top (); + auto [block, limiter] = buckets->top (); + debug_assert (limiter->available ()); buckets->pop (); lock.unlock (); stats.inc (nano::stat::type::election_scheduler, nano::stat::detail::insert_priority); - auto result = node.active.insert (block.first); + auto result = limiter->activate (block); if (result.inserted) { stats.inc (nano::stat::type::election_scheduler, nano::stat::detail::insert_priority_success);