szaszm 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_r373611234
 
 

 ##########
 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();
 
 Review comment:
   Before doing some additional research, my approach was: I should have a very 
good reason to use `mutable`. The ability to mark `watchDogFunc` as `const` is 
not a good enough reason IMO, but this requires subjective judgement.
   
   Now I came across a great approach on stackoverflow:
   > [mutable] allows the differentiation of bitwise const and logical const. 
Logical const is when an object doesn't change in a way that is visible through 
the public interface, like [mutex].
   https://stackoverflow.com/a/105061/3997716
   
   The change of `last_alert_time_` is observable from the public interface 
which makes marking it `mutable` objectively wrong. It can even be changed 
through the public interface.

----------------------------------------------------------------
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

Reply via email to