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_r373595783
##########
File path: libminifi/src/SchedulingAgent.cpp
##########
@@ -125,6 +138,19 @@ bool SchedulingAgent::onTrigger(const
std::shared_ptr<core::Processor> &processo
return false;
}
+void SchedulingAgent::watchDogFunc() const {
+ std::lock_guard<std::mutex> lock(watchdog_mtx_);
+ auto now = std::chrono::steady_clock::now();
+ for (auto& info : scheduled_processors_) {
+ int64_t elapsed =
std::chrono::duration_cast<std::chrono::milliseconds>(now -
info.last_alert_time_).count();
+ if (elapsed > alert_time_) {
+ logger_->log_warn("%s::onTrigger has been running for %lld ms in %s",
info.name_,
+ std::chrono::duration_cast<std::chrono::milliseconds>(now -
info.start_time_).count(), info.uuid_);
+ info.last_alert_time_ = now;
+ }
Review comment:
Done
----------------------------------------------------------------
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