Skip to content

Commit

Permalink
Call periodic_update from next_batch function
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed May 16, 2024
1 parent db4e890 commit 2df4f5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nano/node/fair_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class fair_queue final
value_type next ()
{
release_assert (!empty ()); // Should be checked before calling next
debug_assert ((std::chrono::steady_clock::now () - last_update) < 60s); // The queue should be cleaned up periodically

if (should_seek ())
{
Expand All @@ -283,6 +284,8 @@ class fair_queue final

std::deque<value_type> next_batch (size_t max_count)
{
periodic_update ();

auto const count = std::min (size (), max_count);

std::deque<value_type> result;
Expand Down Expand Up @@ -364,7 +367,7 @@ class fair_queue final

size_t total_size{ 0 };

std::chrono::steady_clock::time_point last_update{};
std::chrono::steady_clock::time_point last_update{ std::chrono::steady_clock::now () };

public:
std::unique_ptr<container_info_component> collect_container_info (std::string const & name) const
Expand Down

0 comments on commit 2df4f5c

Please sign in to comment.