You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/03/03 08:38:44 UTC

[GitHub] [incubator-inlong] zk1510 commented on a change in pull request #2864: [INLONG-2859][Agent] Optimize stopping Kafka tasks

zk1510 commented on a change in pull request #2864:
URL: https://github.com/apache/incubator-inlong/pull/2864#discussion_r818426221



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/KafkaReader.java
##########
@@ -147,29 +150,14 @@ public Message read() {
 
     @Override
     public boolean isFinished() {
-        if (iterator == null) {
-            // fetch data
-            fetchData(5000);
-            return false;
-        }
-        if (iterator.hasNext()) {
-            lastTime = 0;
-            return false;
-        }
-        // fetch data
-        boolean fetchDataSuccess = fetchData(5000);
-        if (fetchDataSuccess && iterator.hasNext()) {
-            lastTime = 0;
-            return false;
-        } else {
-            if (lastTime == 0) {
-                lastTime = System.currentTimeMillis();
+        if (!isFinished) {
+            if (iterator == null || !iterator.hasNext()) {
+                // fetch data
+                fetchData(5000);

Review comment:
       1.first,fetch data occured in init()
   2.After the consumer poll data is read,then continue fetch data, but The premise is that the task does not stop




-- 
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-unsubscribe@inlong.apache.org

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