Skip to content

Commit

Permalink
Fail deployment when unable to create the vertx httpServer
Browse files Browse the repository at this point in the history
Fixes: #4124
  • Loading branch information
geoand committed Sep 20, 2019
1 parent bd3e6d7 commit 3317896
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,19 +385,27 @@ public void start(Future<Void> startFuture) {
httpServer = vertx.createHttpServer(httpOptions);
httpServer.requestHandler(router);
httpServer.listen(port, host, event -> {
// Port may be random, so set the actual port
httpOptions.setPort(event.result().actualPort());
if (remainingCount.decrementAndGet() == 0) {
startFuture.complete(null);
if (event.cause() != null) {
startFuture.fail(event.cause());
} else {
// Port may be random, so set the actual port
httpOptions.setPort(event.result().actualPort());
if (remainingCount.decrementAndGet() == 0) {
startFuture.complete(null);
}
}
});
if (httpsOptions != null) {
httpsServer = vertx.createHttpServer(httpsOptions);
httpsServer.requestHandler(router);
httpsServer.listen(httpsPort, host, event -> {
httpsOptions.setPort(event.result().actualPort());
if (remainingCount.decrementAndGet() == 0) {
startFuture.complete();
if (event.cause() != null) {
startFuture.fail(event.cause());
} else {
httpsOptions.setPort(event.result().actualPort());
if (remainingCount.decrementAndGet() == 0) {
startFuture.complete();
}
}
});
}
Expand Down Expand Up @@ -476,4 +484,5 @@ public void initChannel(VirtualChannel ch) throws Exception {
public static Router getRouter() {
return router;
}

}

0 comments on commit 3317896

Please sign in to comment.