adamdebreceni commented on code in PR #1519:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1519#discussion_r1123293470


##########
libminifi/src/core/ContentRepository.cpp:
##########
@@ -60,16 +60,29 @@ void ContentRepository::incrementStreamCount(const 
minifi::ResourceClaim &stream
   }
 }
 
+void ContentRepository::removeFromPurgeList() {
+  for (auto it = purge_list_.begin(); it != purge_list_.end();) {
+    if (removeKey(*it)) {
+      purge_list_.erase(it++);
+    } else {
+      ++it;
+    }
+  }
+}
+
 ContentRepository::StreamState ContentRepository::decrementStreamCount(const 
minifi::ResourceClaim &streamId) {
   std::lock_guard<std::mutex> lock(count_map_mutex_);
+  removeFromPurgeList();
   const std::string str = streamId.getContentFullPath();
   auto count = count_map_.find(str);
   if (count != count_map_.end() && count->second > 1) {
     count_map_[str] = count->second - 1;
     return StreamState::Alive;
   } else {
     count_map_.erase(str);
-    remove(streamId);
+    if (!remove(streamId)) {
+      purge_list_.push_back(streamId.getContentFullPath());
+    }

Review Comment:
   could this be in `remove`?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to