From 7d172cfc3a9b72282eb96769df0c47a99ff46065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Sun, 5 May 2024 11:05:40 +0200 Subject: [PATCH] Cleanup --- nano/node/fair_queue.hpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/nano/node/fair_queue.hpp b/nano/node/fair_queue.hpp index 30020d814..1a8561d6f 100644 --- a/nano/node/fair_queue.hpp +++ b/nano/node/fair_queue.hpp @@ -263,25 +263,7 @@ public: public: value_type next () { - debug_assert (!empty ()); // Should be checked before calling next - - auto should_seek = [&, this] () { - if (iterator == queues.end ()) - { - return true; - } - auto & queue = iterator->second; - if (queue.empty ()) - { - return true; - } - // Allow up to `queue.priority` requests to be processed before moving to the next queue - if (counter >= queue.priority) - { - return true; - } - return false; - }; + release_assert (!empty ()); // Should be checked before calling next if (should_seek ()) { @@ -312,6 +294,25 @@ public: } private: + bool should_seek () const + { + if (iterator == queues.end ()) + { + return true; + } + auto & queue = iterator->second; + if (queue.empty ()) + { + return true; + } + // Allow up to `queue.priority` requests to be processed before moving to the next queue + if (counter >= queue.priority) + { + return true; + } + return false; + } + void seek_next () { counter = 0;