nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #743: Minificpp 1169 - Simplify C2 metrics collection and reporting
Date Fri, 24 Apr 2020 12:12:38 GMT

arpadboda commented on a change in pull request #743:
URL: https://github.com/apache/nifi-minifi-cpp/pull/743#discussion_r414501833



##########
File path: libminifi/src/c2/C2Agent.cpp
##########
@@ -110,18 +110,19 @@ C2Agent::C2Agent(const std::shared_ptr<core::controller::ControllerServiceProvid
   functions_.push_back(c2_producer_);
 
   c2_consumer_ = [&]() {
-    auto now = std::chrono::steady_clock::now();
-    if ( queue_mutex.try_lock_until(now + std::chrono::seconds(1)) ) {
-      if (responses.empty()) {
-        queue_mutex.unlock();
-        return utils::TaskRescheduleInfo::RetryIn(std::chrono::milliseconds(100));
+    if ( queue_mutex.try_lock_for(std::chrono::seconds(1)) ) {
+      C2Payload payload(Operation::HEARTBEAT);
+      {
+        std::lock_guard<std::timed_mutex> lock(queue_mutex, std::adopt_lock);

Review comment:
       Nice solution, I like it!




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message