Skip to content

Commit

Permalink
Use priority limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Sep 12, 2023
1 parent b7fc721 commit 23482f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nano/node/scheduler/priority.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <nano/node/node.hpp>
#include <nano/node/scheduler/buckets.hpp>
#include <nano/node/scheduler/limiter.hpp>
#include <nano/node/scheduler/priority.hpp>

nano::scheduler::priority::priority (nano::node & node_a, nano::stats & stats_a) :
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 23482f9

Please sign in to comment.