felix-thinkingdata commented on a change in pull request #4645:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/4645#discussion_r571804750



##########
File path: 
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/alert/AlertClientService.java
##########
@@ -78,40 +72,46 @@ public void close() {
 
     /**
      * alert sync send data
-     * @param groupId
-     * @param title
-     * @param content
-     * @return
      */
-    public AlertSendResponseCommand sendAlert(int groupId, String title,  
String content) {
-        return this.sendAlert(this.host,this.port,groupId,title,content);
+    public AlertSendResponseCommand sendAlert(int groupId, String title, 
String content) {
+        return this.sendAlert(this.host, this.port, groupId, title, content);
     }
 
     /**
      * alert sync send data
+     *
      * @param host host
      * @param port port
      * @param groupId groupId
      * @param title title
      * @param content content
      * @return AlertSendResponseCommand
      */
-    public AlertSendResponseCommand sendAlert(String host, int port, int 
groupId, String title,  String content) {
+    public AlertSendResponseCommand sendAlert(String host, int port, int 
groupId, String title, String content) {
         logger.info("sync alert send, host : {}, port : {}, groupId : {}, 
title : {} ", host, port, groupId, title);
         AlertSendRequestCommand request = new AlertSendRequestCommand(groupId, 
title, content);
-        final Host address = new Host(host, port);
-        try {
-            Command command = request.convert2Command();
-            Command response = this.client.sendSync(address, command, 
ALERT_REQUEST_TIMEOUT);
-            if (response != null) {
-                return JsonSerializer.deserialize(response.getBody(), 
AlertSendResponseCommand.class);
+        AlertSendResponseCommand alertSendResponseCommand = null;
+        String[] hosts = host.split(",");
+        for (String hostName : hosts) {
+            final Host address = new Host(hostName, port);

Review comment:
       1.  it will not resend twice, the return will drop on the first success.
   2.Second, I'll do a unified optimization after that. Because now there are 
duplicate alerts if the worker hangs up. The worker will immediately hang up, 
and the worker will send an alert of his hanging up.
   ---
   
   
   1. 不会重发两次,第一次成功就return掉了。
   2.第二点,之后我会统一优化一次。因为现在如果worker挂掉,存在重复告警。存在worker马上挂掉,自己也会自己发自己挂掉的告警。




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

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


Reply via email to