Skip to content

Commit

Permalink
Fail with exception on timeout while waiting for connection pool
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-sqills committed Jul 31, 2023
1 parent 9073da6 commit 64f33ae
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import io.netty.channel.EventLoop;
import io.vertx.core.*;
import io.vertx.core.http.ConnectionPoolTooBusyException;
import io.vertx.core.impl.ContextInternal;
import io.vertx.core.impl.EventLoopContext;
import io.vertx.core.impl.VertxInternal;
Expand Down Expand Up @@ -217,12 +218,10 @@ public void onEnqueue(PoolWaiter<PooledConnection> waiter) {
if (timeout > 0L && timerID == -1L) {
timerID = context.setTimer(timeout, id -> {
pool.cancel(waiter, ar -> {
if (ar.succeeded()) {
if (ar.result()) {
handler.handle(Future.failedFuture("Timeout"));
}
if (ar.succeeded() && ar.result()) {
handler.handle(Future.failedFuture(new ConnectionPoolTooBusyException("Timeout while waiting for connection")));
} else {
// ????
handler.handle(Future.failedFuture(new ConnectionPoolTooBusyException("Failed to cancel pool request after timeout while waiting for connection")));
}
});
});
Expand Down

0 comments on commit 64f33ae

Please sign in to comment.