Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit d96445b

Browse files
committed
Alllow async timeout to be configured fix #469
1 parent 3e00f3a commit d96445b

File tree

2 files changed

+7
-48
lines changed

2 files changed

+7
-48
lines changed

graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLServletProperties.java

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,24 @@
1616
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1717
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1818
*/
19-
2019
package graphql.kickstart.spring.web.boot;
2120

2221
import graphql.kickstart.execution.context.ContextSetting;
22+
import lombok.Data;
2323
import org.springframework.boot.context.properties.ConfigurationProperties;
2424

2525
/**
2626
* @author <a href="mailto:java.lang.RuntimeException@gmail.com">oEmbedler Inc.</a>
2727
*/
28+
@Data
2829
@ConfigurationProperties(prefix = "graphql.servlet")
2930
public class GraphQLServletProperties {
3031

31-
private String mapping;
32-
33-
private boolean asyncModeEnabled = false;
34-
32+
private String mapping = "/graphql";
3533
private boolean exceptionHandlersEnabled = false;
36-
3734
private long subscriptionTimeout = 0;
38-
3935
private ContextSetting contextSetting = ContextSetting.PER_QUERY_WITH_INSTRUMENTATION;
40-
41-
public String getMapping() {
42-
return mapping != null ? mapping : "/graphql";
43-
}
44-
45-
public void setMapping(String mapping) {
46-
this.mapping = mapping;
47-
}
36+
private long asyncTimeout = 30000;
4837

4938
private boolean mappingIsServletWildcard() {
5039
return getMapping().endsWith("/*");
@@ -69,8 +58,8 @@ public String getServletMapping() {
6958
}
7059

7160
/**
72-
* @return the servlet mapping, coercing into an appropriate wildcard for CORS, which uses ant matchers (ending in
73-
* /**)
61+
* @return the servlet mapping, coercing into an appropriate wildcard for CORS, which uses ant
62+
* matchers (ending in /**)
7463
*/
7564
public String getCorsMapping() {
7665
final String mapping = getMapping();
@@ -83,35 +72,4 @@ public String getCorsMapping() {
8372
}
8473
}
8574

86-
public boolean isAsyncModeEnabled() {
87-
return asyncModeEnabled;
88-
}
89-
90-
public void setAsyncModeEnabled(boolean asyncModeEnabled) {
91-
this.asyncModeEnabled = asyncModeEnabled;
92-
}
93-
94-
public boolean isExceptionHandlersEnabled() {
95-
return exceptionHandlersEnabled;
96-
}
97-
98-
public void setExceptionHandlersEnabled(boolean exceptionHandlersEnabled) {
99-
this.exceptionHandlersEnabled = exceptionHandlersEnabled;
100-
}
101-
102-
public long getSubscriptionTimeout() {
103-
return subscriptionTimeout;
104-
}
105-
106-
public void setSubscriptionTimeout(long subscriptionTimeout) {
107-
this.subscriptionTimeout = subscriptionTimeout;
108-
}
109-
110-
public ContextSetting getContextSetting() {
111-
return contextSetting;
112-
}
113-
114-
public void setContextSetting(ContextSetting contextSetting) {
115-
this.contextSetting = contextSetting;
116-
}
11775
}

graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public GraphQLConfiguration graphQLServletConfiguration(GraphQLInvocationInputFa
289289
.with(batchInputPreProcessor)
290290
.with(graphQLServletProperties.getContextSetting())
291291
.with(responseCacheManager)
292+
.asyncTimeout(graphQLServletProperties.getAsyncTimeout())
292293
.build();
293294
}
294295

0 commit comments

Comments
 (0)