This is an automated email from the ASF dual-hosted git repository.

adebreceni pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 47000876a2cdcdb6d055527ceca4b337769c2e68
Author: Marton Szasz <[email protected]>
AuthorDate: Fri Apr 1 12:57:02 2022 +0200

    MINIFICPP-1788 flush old bins on expiration
    
    Before this change, if there were old flow files in
    MergeContent/BinFiles, they were stuck until there was another incoming
    flow file to the processor, because the processor was not triggered,
    regardless of scheduling strategy.
    
    Now the processor is always triggered, regardless of incoming flow
    files, so it can check and flush expired bins. This didn't result in a
    noticably increased CPU usage even with EVENT_TRIGGERED scheduling
    strategy on my system.
    
    Signed-off-by: Adam Debreceni <[email protected]>
    
    This closes #1293
---
 extensions/libarchive/BinFiles.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/extensions/libarchive/BinFiles.cpp 
b/extensions/libarchive/BinFiles.cpp
index e8d6e64..9ba49e4 100644
--- a/extensions/libarchive/BinFiles.cpp
+++ b/extensions/libarchive/BinFiles.cpp
@@ -119,6 +119,8 @@ void BinFiles::onSchedule(core::ProcessContext *context, 
core::ProcessSessionFac
     logger_->log_debug("BinFiles: MaxBinCount [%" PRIu32 "]", maxBinCount_);
   }
   if (auto max_bin_age = 
context->getProperty<core::TimePeriodValue>(MaxBinAge)) {
+    // We need to trigger the processor even when there are no incoming flow 
files so that it can flush the bins.
+    setTriggerWhenEmpty(true);
     this->binManager_.setBinAge(max_bin_age->getMilliseconds());
     logger_->log_debug("BinFiles: MaxBinAge [%" PRId64 "] ms", 
int64_t{max_bin_age->getMilliseconds().count()});
   }

Reply via email to