Skip to content

Commit

Permalink
Remove critical event from the payload
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed May 29, 2024
1 parent 1800b49 commit 30fcd4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public <E> void unsafeCreateEvents(@NonNull @Valid Collection<E> events) {
.filter(EventPayloadExtractor::isNonCritical)
.toList();

criticalEvents.forEach(event -> EventPayloadExtractor.removeCritical(event));
nonCriticalEvents.forEach(event -> EventPayloadExtractor.removeCritical(event));

if (!criticalEvents.isEmpty()) {
this.criticalClient.createEvents(criticalEvents);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ static boolean isNonCritical(Map<String, Object> payload) {
return !isCritical(payload);
}

static void removeCritical(Map<String, Object> event) {
event.remove("critical");
}

/**
* Extracts the paylaod for the event.
*
Expand Down

0 comments on commit 30fcd4c

Please sign in to comment.