Skip to content

Commit 8c09cf4

Browse files
committed
fix(UtmAlertServiceImpl): filter alerts to process only non parent alerts for notifications
1 parent 5183806 commit 8c09cf4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backend/src/main/java/com/park/utmstack/service/impl/UtmAlertServiceImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ public void checkForNewAlerts() {
104104
initialDate.setLastAlertTimestamp(alerts.get(alerts.size() - 1).getTimestampAsInstant());
105105
lastAlertRepository.save(initialDate);
106106

107-
for (UtmAlert alert : alerts) {
107+
List<UtmAlert> parentsAlert = alerts.stream()
108+
.filter(a -> Objects.isNull(a.getParentId()))
109+
.toList();
110+
111+
for (UtmAlert alert : parentsAlert) {
108112
String emails = Constants.CFG.get(Constants.PROP_ALERT_ADDRESS_TO_NOTIFY_ALERTS);
109113

110114
if (!StringUtils.hasText(emails)) {

0 commit comments

Comments
 (0)