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/08/03 07:45:05 UTC

[GitHub] [inlong] haibo-duan commented on a diff in pull request #5332: [INLONG-5222][Manager][Agent][DataProxy] Add heartbeat mechanism for Inlong component cluster

haibo-duan commented on code in PR #5332:
URL: https://github.com/apache/inlong/pull/5332#discussion_r936337763


##########
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/HeartbeatManager.java:
##########
@@ -70,13 +88,65 @@ public HeartbeatManager(AgentManager agentManager) {
         jobmanager = agentManager.getJobManager();
         httpManager = new HttpManager(conf);
         baseManagerUrl = buildBaseUrl();
-        reportSnapshotUrl = builReportSnapShotUrl(baseManagerUrl);
+        reportSnapshotUrl = buildReportSnapShotUrl(baseManagerUrl);
+        reportHeartbeatUrl = buildReportHeartbeatUrl();
+    }
+
+    @Override
+    public void start() throws Exception {
+        submitWorker(snapshotReportThread());
+        submitWorker(heartbeatReportThread());
+    }
+
+    private Runnable snapshotReportThread() {
+        return () -> {
+            while (isRunnable()) {
+                try {
+                    TaskSnapshotRequest taskSnapshotRequest = buildTaskSnapshotRequest();
+                    httpManager.doSentPost(reportSnapshotUrl, taskSnapshotRequest);
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.debug(" {} report to manager", taskSnapshotRequest);
+                    }
+                    int heartbeatInterval = conf.getInt(AGENT_HEARTBEAT_INTERVAL,

Review Comment:
   the variable 'heartbeatInterval' is only used once. I don't think it is necessary to define the variable.



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