From 6e31aa01f947367b62c917ea28d1fcf495aa7077 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 24 Aug 2021 14:13:43 +0200 Subject: [PATCH] Ignore release errors for empty searchers --- .../java/it/cavallium/dbengine/client/SearchResult.java | 4 +++- .../java/it/cavallium/dbengine/client/SearchResultKeys.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/client/SearchResult.java b/src/main/java/it/cavallium/dbengine/client/SearchResult.java index 7a218a2..342e0a7 100644 --- a/src/main/java/it/cavallium/dbengine/client/SearchResult.java +++ b/src/main/java/it/cavallium/dbengine/client/SearchResult.java @@ -30,7 +30,9 @@ public final class SearchResult { } public static SearchResult empty() { - return new SearchResult<>(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty()); + var sr = new SearchResult(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty()); + sr.releaseCalled = true; + return sr; } public Flux> resultsThenRelease() { diff --git a/src/main/java/it/cavallium/dbengine/client/SearchResultKeys.java b/src/main/java/it/cavallium/dbengine/client/SearchResultKeys.java index a5302a4..adabd99 100644 --- a/src/main/java/it/cavallium/dbengine/client/SearchResultKeys.java +++ b/src/main/java/it/cavallium/dbengine/client/SearchResultKeys.java @@ -32,8 +32,10 @@ public final class SearchResultKeys { }).then(release); } - public static SearchResultKeys empty() { - return new SearchResultKeys<>(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty()); + public static SearchResultKeys empty() { + var sr = new SearchResultKeys(Flux.empty(), TotalHitsCount.of(0, true), Mono.empty()); + sr.releaseCalled = true; + return sr; } public SearchResult withValues(ValueGetter valuesGetter) {