This commit is contained in:
Piotr Wójcik 2024-05-05 11:05:40 +02:00
commit 7d172cfc3a

View file

@ -263,25 +263,7 @@ public:
public: public:
value_type next () value_type next ()
{ {
debug_assert (!empty ()); // Should be checked before calling next release_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;
};
if (should_seek ()) if (should_seek ())
{ {
@ -312,6 +294,25 @@ public:
} }
private: 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 () void seek_next ()
{ {
counter = 0; counter = 0;