Merge pull request #918 from metamx/fix-broker-timeouts

fix query timeouts not being raised by broker
This commit is contained in:
Fangjin Yang 2014-12-01 13:58:04 -07:00
commit 646e184ca6
1 changed files with 12 additions and 7 deletions

View File

@ -159,15 +159,20 @@ public class DirectDruidClient<T> implements QueryRunner<T>
byteCount += response.getContent().readableBytes();
try {
final Map<String, Object> responseContext = objectMapper.readValue(
response.headers().get("X-Druid-Response-Context"), new TypeReference<Map<String, Object>>()
final String responseContext = response.headers().get("X-Druid-Response-Context");
// context may be null in case of error or query timeout
if (responseContext != null) {
context.putAll(
objectMapper.<Map<String, Object>>readValue(
responseContext, new TypeReference<Map<String, Object>>()
{
}
)
);
context.putAll(responseContext);
}
}
catch (IOException e) {
e.printStackTrace();
log.error(e, "Unable to parse response context from url[%s]", url);
}
return super.handleResponse(response);