vernedeng commented on code in PR #8028:
URL: https://github.com/apache/inlong/pull/8028#discussion_r1194009350


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AgentServiceImpl.java:
##########
@@ -663,4 +670,22 @@ public void run() {
         }
     }
 
+    /**
+     * update task which in an incorrect state
+     */
+    private class TaskCleanRunnable implements Runnable {
+
+        @Override
+        public void run() {
+            while (true) {
+                try {
+                    sourceMapper.updateStatusByDeleted();
+                    Thread.sleep(60 * 10000);

Review Comment:
   Magic number



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AgentServiceImpl.java:
##########
@@ -138,11 +140,16 @@ public class AgentServiceImpl implements AgentService {
      */
     @PostConstruct
     private void startHeartbeatTask() {
-        if (enabled) {
+        if (updateTaskTimeoutEnabled) {
             UpdateTaskRunnable taskRunnable = new UpdateTaskRunnable();
             this.executorService.execute(taskRunnable);
             LOGGER.info("update task status started successfully");
         }
+        if (sourceCleanEnabled) {
+            TaskCleanRunnable taskCleanRunnable = new TaskCleanRunnable();
+            this.executorService.execute(taskCleanRunnable);

Review Comment:
   Please use **_ScheduledExcutor_** to schedule the update and clean task.
   There is no need to make a thread pool since you construct a **Runable** but 
never exits with condition, which will occupy one thread directly and nerver 
return it back to the pool



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to