From 3c7c448a013ff9c718a51ec1e3c36d44868b1bb3 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 23 May 2024 10:21:07 +0200 Subject: [PATCH] GH-629 - Improve repository interaction in DefaultEventPublicationRegistry. DefaultEventPublicationRegistry is now directly invoking the corresponding repository to delete events older than a certain duration. --- .../modulith/events/core/DefaultEventPublicationRegistry.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/core/DefaultEventPublicationRegistry.java b/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/core/DefaultEventPublicationRegistry.java index 68ae31bf..4fc12e51 100644 --- a/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/core/DefaultEventPublicationRegistry.java +++ b/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/core/DefaultEventPublicationRegistry.java @@ -158,9 +158,7 @@ public class DefaultEventPublicationRegistry var now = clock.instant(); - deletePublications(event -> event.getCompletionDate() - .filter(date -> date.isBefore(now.minus(duration))) - .isPresent()); + events.deleteCompletedPublicationsBefore(now.minus(duration)); } /*