Skip to content

Commit

Permalink
Fixed imperative leftover, zone schedule list count is now correct
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Apr 25, 2024
1 parent a206380 commit 8681f23
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,13 @@ private Flux<Map.Entry<Calendar, CalendarListEntry>> filterCalendars(Map.Entry<C
var zoneCount = new AtomicInteger();
var calendarClient = source.getKey();

try {

return Flux.fromIterable(source.getValue())
.doOnNext(e -> logger.debug("Calendar found: {}", e.getSummary()))
.filter(e -> name2calendar.containsValue(e.getSummary()))
.doOnNext(e -> logger.debug("Zone schedule found: {}", e.getSummary()))
.doOnNext(e -> zoneCount.incrementAndGet())
.map(e -> new AbstractMap.SimpleEntry<>(calendarClient, e));

} finally {
logger.debug("Zone schedule list: {} items", zoneCount.get());
}
return Flux.fromIterable(source.getValue())
.doOnNext(e -> logger.debug("Calendar found: {}", e.getSummary()))
.filter(e -> name2calendar.containsValue(e.getSummary()))
.doOnNext(e -> logger.debug("Zone schedule found: {}", e.getSummary()))
.doOnNext(e -> zoneCount.incrementAndGet())
.doOnComplete(() -> logger.debug("Zone schedule list: {} items", zoneCount.get()))
.map(e -> new AbstractMap.SimpleEntry<>(calendarClient, e));
}

private Flux<Map.Entry<CalendarListEntry, List<Event>>> getEvents(Map.Entry<Calendar, CalendarListEntry> source) {
Expand Down

0 comments on commit 8681f23

Please sign in to comment.