Skip to content

Commit

Permalink
Tolerate runtime exceptions in flushAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Dec 16, 2024
1 parent 6e9cecd commit b462241
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public ProducerCache() {
.<ProducerCacheKey, Producer<?>>removalListener((key, producer, cause) -> {
log.info("Closing producer for topic {}, cause {}", key.topic(), cause);
CompletableFuture closeFuture =
producer.flushAsync()
CompletableFuture.supplyAsync(() -> producer.flushAsync(), Runnable::run)
.orTimeout(FLUSH_OR_CLOSE_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.exceptionally(ex -> {
Throwable unwrappedCause = FutureUtil.unwrapCompletionException(ex);
Expand Down

0 comments on commit b462241

Please sign in to comment.