Skip to content

Commit

Permalink
fix the reconnect logic
Browse files Browse the repository at this point in the history
  • Loading branch information
quinchs committed Oct 18, 2023
1 parent dfb97dd commit 3be463b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ public CompletionStage<Void> disconnect() {

if(this.channel.isOpen()) {
return send(new Terminate())
.thenCompose(v -> ChannelCompletableFuture.completeFrom(this.channel.disconnect()));
.thenCompose(v -> ChannelCompletableFuture.completeFrom(this.channel.close()));
}

return ChannelCompletableFuture.completeFrom(this.channel.disconnect());
return ChannelCompletableFuture.completeFrom(this.channel.close());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,13 @@ public final CompletionStage<Void> executeQuery(
@NotNull ExecutionArguments args
) {
logger.debug("Execute request: is connected? {}", getDuplexer().isConnected());


if(!getDuplexer().isConnected()) {
// TODO: check for recursion
return connect()
.thenCompose(v -> executeQuery(args));
}

final var hasReleased = new AtomicBoolean();

return CompletableFuture.runAsync(() -> {
Expand Down

0 comments on commit 3be463b

Please sign in to comment.