Browse Source

When the alert is executed, if the alarm group is not bound to the alert plug-in, the alert status is updated to fail.

pull/3/MERGE
CalvinKirs 4 years ago
parent
commit
b23696c388
  1. 3
      dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java
  2. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertPluginInstanceServiceImpl.java

3
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java

@ -75,7 +75,8 @@ public class AlertSender {
List<AlertPluginInstance> alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId); List<AlertPluginInstance> alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId);
if (CollectionUtils.isEmpty(alertInstanceList)) { if (CollectionUtils.isEmpty(alertInstanceList)) {
logger.error("send alert msg fail,no bind plugin instance."); logger.error("send alert msg fail,no bind plugin instance.");
return; alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, "no bind plugin instance", alert.getId());
continue;
} }
AlertData alertData = new AlertData(); AlertData alertData = new AlertData();
alertData.setId(alert.getId()) alertData.setId(alert.getId())

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertPluginInstanceServiceImpl.java

@ -223,7 +223,7 @@ public class AlertPluginInstanceServiceImpl extends BaseService implements Alert
if (CollectionUtils.isEmpty(idsList)) { if (CollectionUtils.isEmpty(idsList)) {
return false; return false;
} }
Optional<String> first = idsList.stream().filter(k -> Arrays.asList(k.split(",")).contains(id)).findFirst(); Optional<String> first = idsList.stream().filter(k -> null != k && Arrays.asList(k.split(",")).contains(id)).findFirst();
return first.isPresent(); return first.isPresent();
} }

Loading…
Cancel
Save