fix query timeouts not being raised by broker

This commit is contained in:
Xavier Léauté 2014-11-26 21:35:01 -08:00
parent 3699a41a54
commit 4dccfda61d
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>>()
{
}
);
context.putAll(responseContext);
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>>()
{
}
)
);
}
}
catch (IOException e) {
e.printStackTrace();
log.error(e, "Unable to parse response context from url[%s]", url);
}
return super.handleResponse(response);