未验证 提交 800681aa 编写于 作者: L lipenghui 提交者: GitHub

Don't fail the health check request when try to delete previous subscription. (#7906)

上级 81202e14
...@@ -275,11 +275,16 @@ public class BrokersBase extends AdminResource { ...@@ -275,11 +275,16 @@ public class BrokersBase extends AdminResource {
// create non-partitioned topic manually and close the previous reader if present. // create non-partitioned topic manually and close the previous reader if present.
try { try {
pulsar().getBrokerService().getTopic(topic, true).get().ifPresent(t -> { pulsar().getBrokerService().getTopic(topic, true).get().ifPresent(t -> {
t.getSubscriptions().values().forEach(Subscription::deleteForcefully); for (Subscription value : t.getSubscriptions().values()) {
try {
value.deleteForcefully();
} catch (Exception e) {
LOG.warn("Failed to delete previous subscription {} for health check", value.getName(), e);
}
}
}); });
} catch (Exception e) { } catch (Exception e) {
asyncResponse.resume(new RestException(e)); LOG.warn("Failed to try to delete subscriptions for health check", e);
return;
} }
CompletableFuture<Producer<String>> producerFuture = CompletableFuture<Producer<String>> producerFuture =
client.newProducer(Schema.STRING).topic(topic).createAsync(); client.newProducer(Schema.STRING).topic(topic).createAsync();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册