Skip to content

Commit 64f33ae

Browse files
committed
Fail with exception on timeout while waiting for connection pool
1 parent 9073da6 commit 64f33ae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/pool/SqlConnectionPool.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import io.netty.channel.EventLoop;
1515
import io.vertx.core.*;
16+
import io.vertx.core.http.ConnectionPoolTooBusyException;
1617
import io.vertx.core.impl.ContextInternal;
1718
import io.vertx.core.impl.EventLoopContext;
1819
import io.vertx.core.impl.VertxInternal;
@@ -217,12 +218,10 @@ public void onEnqueue(PoolWaiter<PooledConnection> waiter) {
217218
if (timeout > 0L && timerID == -1L) {
218219
timerID = context.setTimer(timeout, id -> {
219220
pool.cancel(waiter, ar -> {
220-
if (ar.succeeded()) {
221-
if (ar.result()) {
222-
handler.handle(Future.failedFuture("Timeout"));
223-
}
221+
if (ar.succeeded() && ar.result()) {
222+
handler.handle(Future.failedFuture(new ConnectionPoolTooBusyException("Timeout while waiting for connection")));
224223
} else {
225-
// ????
224+
handler.handle(Future.failedFuture(new ConnectionPoolTooBusyException("Failed to cancel pool request after timeout while waiting for connection")));
226225
}
227226
});
228227
});

0 commit comments

Comments
 (0)