arpadboda commented on a change in pull request #721: MINIFICPP-1135 - Add a
watchdog to schedulingAgent to warn in case of…
URL: https://github.com/apache/nifi-minifi-cpp/pull/721#discussion_r374057233
##########
File path: libminifi/include/SchedulingAgent.h
##########
@@ -190,11 +207,27 @@ class SchedulingAgent {
std::shared_ptr<core::controller::ControllerServiceProvider>
controller_service_provider_;
private:
+ struct SchedulingInfo {
+ std::chrono::time_point<std::chrono::steady_clock> start_time_ =
std::chrono::steady_clock::now();
+ mutable std::chrono::time_point<std::chrono::steady_clock>
last_alert_time_ = std::chrono::steady_clock::now();
+ std::string name_;
+ std::string uuid_;
+
+ explicit SchedulingInfo(const std::shared_ptr<core::Processor> &processor)
:
+ name_(processor->getName()),
+ uuid_(processor->getUUIDStr()) {}
+
+ bool operator <(const SchedulingInfo& o) const {
+ return std::tie(start_time_, name_, uuid_) < std::tie(o.start_time_,
o.name_, o.uuid_);
+ }
+ };
+
// Logger
std::shared_ptr<logging::Logger> logger_;
- // Prevent default copy constructor and assignment operation
- // Only support pass by reference or pointer
-
+ mutable std::mutex watchdog_mtx_; // used to protect the set below
+ std::set<SchedulingInfo> scheduled_processors_; // set was chosen to avoid
iterator invalidation
+ std::unique_ptr<utils::CallBackTimer> watchDogTimer_;
+ std::chrono::milliseconds alert_time_; // msec
Review comment:
Renamed both.
----------------------------------------------------------------
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]
With regards,
Apache Git Services