mirror of https://github.com/apache/druid.git
default query timeout to server idle timeout
This commit is contained in:
parent
e76561e400
commit
03efbb0e02
|
@ -41,6 +41,7 @@ import io.druid.query.DataSourceUtil;
|
|||
import io.druid.query.Query;
|
||||
import io.druid.query.QueryInterruptedException;
|
||||
import io.druid.query.QuerySegmentWalker;
|
||||
import io.druid.server.initialization.ServerConfig;
|
||||
import io.druid.server.log.RequestLogger;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -70,6 +71,7 @@ public class QueryResource
|
|||
public static final String APPLICATION_SMILE = "application/smile";
|
||||
public static final String APPLICATION_JSON = "application/json";
|
||||
|
||||
private final ServerConfig config;
|
||||
private final ObjectMapper jsonMapper;
|
||||
private final ObjectMapper smileMapper;
|
||||
private final QuerySegmentWalker texasRanger;
|
||||
|
@ -79,6 +81,7 @@ public class QueryResource
|
|||
|
||||
@Inject
|
||||
public QueryResource(
|
||||
ServerConfig config,
|
||||
@Json ObjectMapper jsonMapper,
|
||||
@Smile ObjectMapper smileMapper,
|
||||
QuerySegmentWalker texasRanger,
|
||||
|
@ -87,6 +90,7 @@ public class QueryResource
|
|||
QueryManager queryManager
|
||||
)
|
||||
{
|
||||
this.config = config;
|
||||
this.jsonMapper = jsonMapper.copy();
|
||||
this.jsonMapper.getFactory().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
|
||||
|
||||
|
@ -135,6 +139,15 @@ public class QueryResource
|
|||
queryId = UUID.randomUUID().toString();
|
||||
query = query.withId(queryId);
|
||||
}
|
||||
if (query.getContextValue("timeout") == null) {
|
||||
query = query.withOverriddenContext(
|
||||
ImmutableMap.of(
|
||||
"timeout",
|
||||
config.getMaxIdleTime().toStandardDuration().getMillis()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Got query [%s]", query);
|
||||
|
|
Loading…
Reference in New Issue