You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sz...@apache.org on 2020/08/23 20:29:03 UTC

[nifi-minifi-cpp] branch main updated: MINIFICPP-1335 TailFile no longer generates an empty flowfile...

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 832c55c  MINIFICPP-1335 TailFile no longer generates an empty flowfile...
832c55c is described below

commit 832c55ccb74cce73c054d918bb6380c96eb5ed94
Author: Arpad Boda <ab...@apache.org>
AuthorDate: Sun Aug 23 22:27:24 2020 +0200

    MINIFICPP-1335 TailFile no longer generates an empty flowfile...
    
    ...in every onTrigger call when used without delimiter
    
    Signed-off-by: Marton Szasz <sz...@gmail.com>
    
    This closes #876
---
 extensions/standard-processors/processors/TailFile.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/extensions/standard-processors/processors/TailFile.cpp b/extensions/standard-processors/processors/TailFile.cpp
index c5d2a1a..913fb59 100644
--- a/extensions/standard-processors/processors/TailFile.cpp
+++ b/extensions/standard-processors/processors/TailFile.cpp
@@ -654,8 +654,12 @@ void TailFile::onTrigger(const std::shared_ptr<core::ProcessContext> &, const st
 void TailFile::processFile(const std::shared_ptr<core::ProcessSession> &session,
                            const std::string &full_file_name,
                            TailState &state) {
-  if (utils::file::FileUtils::file_size(full_file_name) < state.position_) {
+  uint64_t fsize = utils::file::FileUtils::file_size(full_file_name);
+  if (fsize < state.position_) {
     processRotatedFiles(session, state);
+  } else if (fsize == state.position_) {
+    logger_->log_trace("Skipping file %s as its size hasn't change since last read", state.file_name_);
+    return;
   }
 
   processSingleFile(session, full_file_name, state);