jetcd: Detecting connection errors
Hi!
What is the correct way to do KV requests with a timeout? The client seems to retry forever (jetcd 0.5.10). My code looks like this:
Client etcd = Client.builder()
.endpoints("http://127.0.0.1:2379")
.connectTimeout(Duration.ofSeconds(1))
.build();
CountDownLatch countDownLatch = new CountDownLatch(1);
etcd.getKVClient()
.get(ByteSequence.from("/x", StandardCharsets.UTF_8))
.whenComplete((response, throwable) -> {
if (throwable != null) {
throwable.printStackTrace();
}
System.out.println("response = " + response);
countDownLatch.countDown();
});
countDownLatch.await();
System.out.println("done");
If I run this code without ectd running, it will never terminate. I’ve tried different retry options to the client builder but I can’t get it to work.
Thanks, Anton
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (6 by maintainers)
I’ll do it today or tomorrow
On Thu, 28 Oct 2021 at 11:32, Anton Lindström @.***> wrote:
–
Luca Burgazzoli
I’m waiting for feedback on another pr, then I can do a release
I’ve updated #971 with a fix!