Skip to content

Commit

Permalink
issue #3602 refactor processHighNetworkConsumingRun to fix notificati…
Browse files Browse the repository at this point in the history
…on repeat
  • Loading branch information
SilinPavel committed Aug 27, 2024
1 parent 0caaed9 commit 3556213
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ private void performHighNetworkConsumingNotify(final PipelineRun run, final doub
run.setLastNetworkConsumptionNotificationTime(DateUtils.nowUTC());
pipelinesToNotify.add(new ImmutablePair<>(run, networkBandwidthLevel));
runsToUpdateNotificationTime.add(run);

}

private void performStop(final PipelineRun run,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ public void notifyHighNetworkConsumingRuns(final List<Pair<PipelineRun, Double>>
final Map<String, NotificationFilter> runParametersFilters = parseRunExcludeParams();

final List<Pair<PipelineRun, Double>> filtered = pipelineNetworkBandwidthPairs.stream()
.filter(pair -> shouldNotifyHighNetworkConsumingRun(pair.getLeft().getId(), type, settings))
.filter(pair -> noneMatchExcludedInstanceType(pair.getLeft(), instanceTypesToExclude))
.filter(pair -> !matchExcludeRunParameters(pair.getLeft(), runParametersFilters))
.collect(Collectors.toList());
Expand All @@ -377,13 +376,6 @@ public void notifyHighNetworkConsumingRuns(final List<Pair<PipelineRun, Double>>
pair.getRight(), bandwidthLimit, type))
.collect(Collectors.toList());
saveNotifications(messages);

if (NotificationType.HIGH_CONSUMED_NETWORK_BANDWIDTH.equals(type)) {
final List<Long> runIds = filtered.stream()
.map(pair -> pair.getLeft().getId()).collect(Collectors.toList());
monitoringNotificationDao.updateNotificationTimestamp(runIds,
NotificationType.HIGH_CONSUMED_NETWORK_BANDWIDTH);
}
}

private NotificationMessage buildMessageForHighNetworkConsumingRun(final NotificationSettings settings,
Expand Down Expand Up @@ -899,15 +891,6 @@ private boolean shouldNotifyIdleRun(final Long runId, final NotificationType not
return shouldNotify(runId, notificationSettings);
}

private boolean shouldNotifyHighNetworkConsumingRun(final Long runId,
final NotificationType notificationType,
final NotificationSettings notificationSettings) {
if (!NotificationType.HIGH_CONSUMED_NETWORK_BANDWIDTH.equals(notificationType)) {
return true;
}
return shouldNotify(runId, notificationSettings);
}

private Map<String, NotificationFilter> parseRunExcludeParams() {
final Map<String, NotificationFilter> excludeParams = preferenceManager.getPreference(
SystemPreferences.SYSTEM_NOTIFICATIONS_EXCLUDE_PARAMS);
Expand Down

0 comments on commit 3556213

Please sign in to comment.