Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/114#discussion_r123503614
  
    --- Diff: libminifi/src/RemoteProcessorGroupPort.cpp ---
    @@ -54,19 +57,29 @@ bool create = true) {
       std::unique_ptr<Site2SiteClientProtocol> nextProtocol = nullptr;
       if (!available_protocols_.try_dequeue(nextProtocol)) {
         if (create) {
    +      refreshPeerList();
           // create
    -      nextProtocol = std::unique_ptr<Site2SiteClientProtocol>(new 
Site2SiteClientProtocol(nullptr));
    -      nextProtocol->setPortId(protocol_uuid_);
    -      std::unique_ptr<org::apache::nifi::minifi::io::DataStream> str = 
std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(stream_factory_->createSocket(host_,
 port_));
    -      std::unique_ptr<Site2SitePeer> peer_ = 
std::unique_ptr<Site2SitePeer>(new Site2SitePeer(std::move(str), host_, port_));
    -      nextProtocol->setPeer(std::move(peer_));
    +      for (auto peer : site2site_peer_status_list_) {
    +        std::unique_ptr<Site2SiteClientProtocol> protocol = nullptr;
    +        protocol = std::unique_ptr < Site2SiteClientProtocol
    +            > (new Site2SiteClientProtocol(nullptr));
    +        protocol->setPortId(protocol_uuid_);
    +        std::unique_ptr<org::apache::nifi::minifi::io::DataStream> str =
    +            std::unique_ptr < org::apache::nifi::minifi::io::DataStream
    +                > (stream_factory_->createSocket(peer.host_, peer.port_));
    +        std::unique_ptr<Site2SitePeer> peer_ = std::unique_ptr < 
Site2SitePeer
    +            > (new Site2SitePeer(std::move(str), peer.host_, peer.port_));
    +        protocol->setPeer(std::move(peer_));
    +        returnProtocol(std::move(protocol));
    +      }
         }
    +    available_protocols_.try_dequeue(nextProtocol);
       }
       return std::move(nextProtocol);
     }
     
     void 
RemoteProcessorGroupPort::returnProtocol(std::unique_ptr<Site2SiteClientProtocol>
 return_protocol) {
    -  if (available_protocols_.size_approx() >= max_concurrent_tasks_) {
    +  if (available_protocols_.size_approx() >= (max_concurrent_tasks_ * 
site2site_peer_status_list_.size())) {
    --- End diff --
    
    Why should this change? 
    With 10 concurrent tasks ( threads ) and 10 peers, you need 100 queued 
elements? Shouldn't you only need ten 
     ( +/- a few ) since you only have ten threads to pull objects? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to