You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Oliverwqcwrw (via GitHub)" <gi...@apache.org> on 2023/02/08 01:08:26 UTC

[GitHub] [rocketmq-connect] Oliverwqcwrw commented on a diff in pull request #423: [ISSUES #422] redress running status

Oliverwqcwrw commented on code in PR #423:
URL: https://github.com/apache/rocketmq-connect/pull/423#discussion_r1099509810


##########
rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/connectorwrapper/Worker.java:
##########
@@ -900,6 +910,21 @@ private void startTask(Map<String, List<ConnectKeyValue>> newTasks) throws Excep
         }
     }
 
+    private void redressRunningStatus(WorkerTask workerTask) {
+        TaskStatus taskStatus = stateManagementService.get(workerTask.id);
+        if (taskStatus != null && taskStatus.getState() != RUNNING && taskStatus.getState() != PAUSED) {
+            ConnectorStatus connectorStatus = stateManagementService.get(workerTask.id.connector());
+            TaskStatus newTaskStatus;
+            if (null != connectorStatus && connectorStatus.getState() == PAUSED) {
+                newTaskStatus = new TaskStatus(workerTask.id, PAUSED, workerConfig.getWorkerId(), System.currentTimeMillis());
+            } else {
+                newTaskStatus = new TaskStatus(workerTask.id, RUNNING, workerConfig.getWorkerId(), System.currentTimeMillis());

Review Comment:
   IMO, It is better to set the task status to running when the connector is in the running state. If the connector is failed, the task is also set to running at present



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

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