Skip to content

Commit

Permalink
Merge pull request quarkusio#26934 from phillip-kruger/graphql-termin…
Browse files Browse the repository at this point in the history
…ate-issue

GraphQL to terminate the request even if it was active
  • Loading branch information
gsmet authored Jul 26, 2022
2 parents c7a9f2b + 08e5c31 commit 872fda2
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 872fda2

Please sign in to comment.