Skip to content

Commit beb693e

Browse files
committed
(fix) complete unsubscribe future even on close failed
1 parent 6324eff commit beb693e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/java/cn/leancloud/kafka/consumer/Fetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void run() {
153153

154154
unsubscribedStatus = UnsubscribedStatus.ERROR;
155155
markClosed();
156-
logger.error("Fetcher quit with unexpected exception. Will rebalance after poll timeout.", ex);
156+
logger.error("Fetcher quit with unexpected exception.", ex);
157157
break;
158158
}
159159
}

src/main/java/cn/leancloud/kafka/consumer/LcKafkaConsumer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,11 @@ private CompletableFuture<UnsubscribedStatus> setupUnsubscribedFuture() {
189189
// returned CompletableFuture
190190
final CompletableFuture<UnsubscribedStatus> ret = new CompletableFuture<>();
191191
fetcher.unsubscribeStatusFuture().thenAccept(status -> {
192-
close();
193-
ret.complete(status);
192+
try {
193+
close();
194+
} finally {
195+
ret.complete(status);
196+
}
194197
});
195198
return ret;
196199
}

0 commit comments

Comments
 (0)