Ignore release errors for empty searchers

This commit is contained in:
Andrea Cavalli 2021-08-24 14:13:43 +02:00
parent 2207ae4314
commit 6e31aa01f9
2 changed files with 7 additions and 3 deletions

View File

@ -30,7 +30,9 @@ public final class SearchResult<T, U> {
}
public static <T, U> SearchResult<T, U> empty() {
return new SearchResult<>(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty());
var sr = new SearchResult<T, U>(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty());
sr.releaseCalled = true;
return sr;
}
public Flux<SearchResultItem<T, U>> resultsThenRelease() {

View File

@ -32,8 +32,10 @@ public final class SearchResultKeys<T> {
}).then(release);
}
public static <T, U> SearchResultKeys<T> empty() {
return new SearchResultKeys<>(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty());
public static <T> SearchResultKeys<T> empty() {
var sr = new SearchResultKeys<T>(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty());
sr.releaseCalled = true;
return sr;
}
public <U> SearchResult<T, U> withValues(ValueGetter<T, U> valuesGetter) {