Skip to content

Commit

Permalink
Merge pull request #4128 from geoand/#4124
Browse files Browse the repository at this point in the history
Fail deployment when unable to create the vertx httpServer
  • Loading branch information
gsmet authored Sep 21, 2019
2 parents 0e07a42 + 3317896 commit 3421fd3
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 3421fd3

Please sign in to comment.