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


##########
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();

Review Comment:
   the cleanup logic is quite similar to `FlowFileRepository`'s background 
`flush` thread (and the planned `DatabaseContentRepository`'s background batch 
cleanup), I think we should move this cleanup task out of 
`decrementStreamCount`'s responsibilities



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to