Skip to content

Commit

Permalink
fix(liveness): execute on worker pool (#1779) (#1780)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9287edf)

Co-authored-by: Andrew Azores <[email protected]>
  • Loading branch information
mergify[bot] and andrewazores authored Nov 17, 2023
1 parent 4bab068 commit 8f7a234
Showing 1 changed file with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ class HealthLivenessGetHandler implements RequestHandler {
@Inject
HealthLivenessGetHandler() {}

@Override
public void handle(RoutingContext ctx) {
ctx.response().setStatusCode(204).end();
}

@Override
public ApiVersion apiVersion() {
return ApiVersion.GENERIC;
Expand All @@ -55,4 +50,25 @@ public HttpMethod httpMethod() {
public Set<ResourceAction> resourceActions() {
return ResourceAction.NONE;
}

@Override
public boolean isAsync() {
// This response handler does not actually block, but we force it to execute on the worker
// pool so that the status check reports not only that the event loop dispatch thread is
// alive and responsive, but that the worker pool is also actively servicing requests. If we
// don't force this then this handler only checks if the event loop is alive, but the worker
// pool may be blocked or otherwise unresponsive and the application as a whole will not be
// usable.
return false;
}

@Override
public boolean isOrdered() {
return true;
}

@Override
public void handle(RoutingContext ctx) {
ctx.response().setStatusCode(204).end();
}
}

0 comments on commit 8f7a234

Please sign in to comment.