Skip to content

Commit

Permalink
Improve fair_queue::next_batch ()
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed May 5, 2024
1 parent 5ac4317 commit 02b5c82
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nano/node/fair_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ class fair_queue final

std::deque<value_type> next_batch (size_t max_count)
{
// TODO: Naive implementation, could be optimized
auto count = std::min (size (), max_count);

std::deque<value_type> result;
while (!empty () && result.size () < max_count)
while (result.size () < count)
{
result.emplace_back (next ());
}
Expand Down

0 comments on commit 02b5c82

Please # to comment.