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


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AgentServiceImpl.java:
##########
@@ -138,11 +144,30 @@ public class AgentServiceImpl implements AgentService {
      */
     @PostConstruct
     private void startHeartbeatTask() {
-        if (enabled) {
-            UpdateTaskRunnable taskRunnable = new UpdateTaskRunnable();
-            this.executorService.execute(taskRunnable);
+        if (updateTaskTimeoutEnabled) {
+            ScheduledExecutorService executor = 
Executors.newSingleThreadScheduledExecutor();
+            executor.scheduleWithFixedDelay(() -> {
+                try {
+                    sourceMapper.updateStatusToTimeout(beforeSeconds);
+                    LOGGER.info("update task status successfully");
+                } catch (Throwable t) {
+                    LOGGER.error("update task status error", t);
+                }
+            }, 0, beforeSeconds, TimeUnit.SECONDS);
             LOGGER.info("update task status started successfully");
         }
+        if (sourceCleanEnabled) {
+            ScheduledExecutorService executor = 
Executors.newSingleThreadScheduledExecutor();

Review Comment:
   Name to "scheduled-source-deleted-%d".



-- 
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