lordgamez commented on a change in pull request #865:
URL: https://github.com/apache/nifi-minifi-cpp/pull/865#discussion_r468525812
##########
File path: libminifi/src/core/ProcessGroup.cpp
##########
@@ -263,26 +263,21 @@ void ProcessGroup::stopProcessing(const
std::shared_ptr<TimerDrivenSchedulingAge
}
}
-std::shared_ptr<Processor> ProcessGroup::findProcessor(utils::Identifier
&uuid) {
- std::lock_guard<std::recursive_mutex> lock(mutex_);
- std::shared_ptr<Processor> ret = NULL;
- for (auto processor : processors_) {
- logger_->log_debug("find processor %s", processor->getName());
+std::shared_ptr<Processor> ProcessGroup::findProcessorById(const
utils::Identifier& uuid) const {
+ const auto id_matches = [&] (const std::shared_ptr<Processor>& processor) {
+ logger_->log_debug("Current processor is %s", processor->getName());
utils::Identifier processorUUID;
+ return processor->getUUID(processorUUID) && uuid == processorUUID;
+ };
+ return findProcessor(id_matches);
+}
- if (processor->getUUID(processorUUID)) {
- if (uuid == processorUUID) {
- return processor;
- }
- }
- }
- for (auto processGroup : child_process_groups_) {
- logger_->log_debug("find processor child %s", processGroup->getName());
- std::shared_ptr<Processor> processor = processGroup->findProcessor(uuid);
- if (processor)
- return processor;
- }
- return ret;
+std::shared_ptr<Processor> ProcessGroup::findProcessorByName(const std::string
&processorName) const {
+ const auto name_matches = [&] (const std::shared_ptr<Processor>& processor) {
Review comment:
Only capture processorName here as well.
----------------------------------------------------------------
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]