Skip to content

Commit

Permalink
Simplify the conditional statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed Dec 11, 2023
1 parent e58d199 commit 60352d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Service/RequestProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ void RequestProcessor::run()
/// Suppose there is a sequence of write-read requests, 'moveRequestToPendingQueue' move all requests
/// to pending queue and then the first loop handle the write request, then If we do not check the
/// pending queue in our wait condition, it will result in meaningless waiting.
size_t pending_requests_size{};
bool pending_requests_empty = true;
for (const auto & [_, runner_pending_requests] : pending_requests)
{
for (const auto & [session_, session_pending_requests] : runner_pending_requests)
pending_requests_size += session_pending_requests.size();
if (!session_pending_requests.empty())
{
pending_requests_empty = false;
break;
}
}
return error_request_ids.empty() && requests_queue->empty() && committed_queue.empty() && pending_requests_size == 0;
return error_request_ids.empty() && requests_queue->empty() && committed_queue.empty() && pending_requests_empty;
};

{
Expand Down

0 comments on commit 60352d5

Please sign in to comment.