You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/03/10 14:02:26 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1022: Refactor ThreadPool::execute to return a future since it always retur…

szaszm commented on a change in pull request #1022:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1022#discussion_r591540089



##########
File path: extensions/standard-processors/processors/GetTCP.cpp
##########
@@ -285,21 +285,17 @@ void GetTCP::onTrigger(const std::shared_ptr<core::ProcessContext> &context, con
       } else {
         logger_->log_error("Could not create socket for %s", endpoint);
       }
-      auto* future = new std::future<int>();
       std::unique_ptr<utils::AfterExecute<int>> after_execute = std::unique_ptr<utils::AfterExecute<int>>(new SocketAfterExecute(running_, endpoint, &live_clients_, &mutex_));
       utils::Worker<int> functor(f_ex, "workers", std::move(after_execute));
-      if (client_thread_pool_.execute(std::move(functor), *future)) {
-        live_clients_[endpoint] = future;
-      }
+      auto* future = new std::future<int>(client_thread_pool_.execute(std::move(functor)));

Review comment:
       It's cleaned up by subsequent `onTrigger` calls, see the branch below. The list is also modified by `SocketAfterExecute`, which looks like it leaks on error, but I didn't verify.




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