Skip to content

Commit b5fe5c7

Browse files
committed
Reuse async context if it's already started
1 parent 2e9f8b2 commit b5fe5c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestHandlerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public void handle(HttpServletRequest request, HttpServletResponse response) thr
5252
private void execute(GraphQLInvocationInput invocationInput, HttpServletRequest request,
5353
HttpServletResponse response) {
5454
if (request.isAsyncSupported()) {
55-
AsyncContext asyncContext = request.startAsync(request, response);
55+
AsyncContext asyncContext = request.isAsyncStarted()
56+
? request.getAsyncContext()
57+
: request.startAsync(request, response);
5658
asyncContext.setTimeout(configuration.getAsyncTimeout());
5759
invoke(invocationInput, request, response)
5860
.thenAccept(result -> writeResultResponse(result, request, response))

0 commit comments

Comments
 (0)