Skip to content

Commit

Permalink
GraphQL to terminate the request even if it was active
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Kruger <[email protected]>
  • Loading branch information
phillip-kruger committed Jul 26, 2022
1 parent 1eb8047 commit 08e5c31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,18 @@ public void handle(Object e) {
@Override
public void handle(final RoutingContext ctx) {

if (currentManagedContext.isActive()) {
handleWithIdentity(ctx);
} else {

ctx.response()
.endHandler(currentManagedContextTerminationHandler)
.exceptionHandler(currentManagedContextTerminationHandler)
.closeHandler(currentManagedContextTerminationHandler);
if (!currentManagedContext.isActive()) {
currentManagedContext.activate();
ctx.response()
.endHandler(currentManagedContextTerminationHandler)
.exceptionHandler(currentManagedContextTerminationHandler)
.closeHandler(currentManagedContextTerminationHandler);

try {
handleWithIdentity(ctx);
} catch (Throwable t) {
currentManagedContext.terminate();
throw t;
}
}
try {
handleWithIdentity(ctx);
} catch (Throwable t) {
currentManagedContext.terminate();
throw t;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ private JsonObject getJsonObjectFromBody(RoutingContext ctx) throws IOException
}

private String readBody(RoutingContext ctx) {
if (ctx.getBody() != null) {
return ctx.getBodyAsString();
if (ctx.body() != null) {
return ctx.body().asString();
}
return null;
}
Expand Down

0 comments on commit 08e5c31

Please sign in to comment.