adamdebreceni commented on a change in pull request #1027:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1027#discussion_r592980213
##########
File path: libminifi/src/utils/FlowFileQueue.cpp
##########
@@ -30,70 +30,41 @@ bool
FlowFileQueue::FlowFilePenaltyExpirationComparator::operator()(const value_
}
FlowFileQueue::value_type FlowFileQueue::pop() {
- if (existsFlowFileWithExpiredPenalty()) {
- value_type next_flow_file = priority_queue_.top();
- priority_queue_.pop();
- return next_flow_file;
+ if (empty()) {
+ throw std::logic_error{"pop() called on an empty FlowFileQueue"};
}
- if (!fifo_queue_.empty()) {
- value_type next_flow_file = fifo_queue_.front();
- fifo_queue_.pop();
- return next_flow_file;
- }
-
- throw std::logic_error{"pop() called on FlowFileQueue when canBePopped() is
false"};
-}
-
-/**
- * Pops any flow file off the queue, whether it has an unexpired penalty or
not.
- */
-FlowFileQueue::value_type FlowFileQueue::forcePop() {
- if (!fifo_queue_.empty()) {
- value_type next_flow_file = fifo_queue_.front();
- fifo_queue_.pop();
- return next_flow_file;
- }
-
- if (!priority_queue_.empty()) {
- value_type next_flow_file = priority_queue_.top();
- priority_queue_.pop();
- return next_flow_file;
- }
-
- throw std::logic_error{"forcePop() called on an empty FlowFileQueue"};
+ value_type next_flow_file = queue_.top();
Review comment:
should we move from `queue_.top()`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]