healchow commented on code in PR #5804:
URL: https://github.com/apache/inlong/pull/5804#discussion_r963435195


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/MonitorTextFile.java:
##########
@@ -111,17 +114,23 @@ public void run() {
                     }
                     listen();
                     TimeUnit.MILLISECONDS.sleep(interval);
-                } catch (Exception e) {
-                    LOGGER.error("monitor {} error:", 
this.fileReaderOperator.file.getName(), e);
                 }
+            } catch (Exception e) {
+                LOGGER.error("monitor {} error:", 
this.fileReaderOperator.file.getName(), e);
             }
         }
 
         private void listen() throws IOException {
             BasicFileAttributes attributesAfter = Files
                     .readAttributes(this.fileReaderOperator.file.toPath(), 
BasicFileAttributes.class);
-            if 
(attributesBefore.lastModifiedTime().compareTo(attributesAfter.lastModifiedTime())
 < 0
-                    && !this.fileReaderOperator.iterator.hasNext()) {
+            if 
(attributesBefore.lastModifiedTime().compareTo(attributesAfter.lastModifiedTime())
 < 0) {

Review Comment:
   Suggested adding a comment for the reason for return.



-- 
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: commits-unsubscr...@inlong.apache.org

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

Reply via email to