adamdebreceni commented on code in PR #1360:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1360#discussion_r945746263
##########
libminifi/src/core/state/nodes/ResponseNodeLoader.cpp:
##########
@@ -59,17 +59,17 @@ void
ResponseNodeLoader::initializeComponentMetrics(core::ProcessGroup* root) {
node_source->getResponseNodes(metric_vector);
std::lock_guard<std::mutex> guard(component_metrics_mutex_);
for (const auto& metric : metric_vector) {
- component_metrics_[metric->getName()] = metric;
+ component_metrics_[metric->getName()].push_back(metric);
}
}
}
-std::shared_ptr<ResponseNode> ResponseNodeLoader::getResponseNode(const
std::string& clazz) const {
+std::vector<std::shared_ptr<ResponseNode>>
ResponseNodeLoader::getResponseNodes(const std::string& clazz) const {
std::shared_ptr<core::CoreComponent> ptr =
core::ClassLoader::getDefaultClassLoader().instantiate(clazz, clazz);
if (ptr == nullptr) {
- return getComponentMetricsNode(clazz);
+ return getComponentMetricsNodes(clazz);
}
- return std::dynamic_pointer_cast<ResponseNode>(ptr);
+ return {std::dynamic_pointer_cast<ResponseNode>(ptr)};
Review Comment:
thinking about it some more, `gsl_Ensures` would document and well... ensure
that some invariant is maintained, but that invariant should not come from or
depend on `gsl_Ensures`, I think we should manually check if the dynamic cast
succeeds, log some errors if not, and return an empty vector in that case
(throwing could also work, not sure what would that trigger though)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]