Commit ce6d286d by Spencer Gibb

Don't execute load balancer twice

fixes gh-323
parent b28fd07c
......@@ -108,14 +108,20 @@ public class RibbonClientHttpRequestFactory implements ClientHttpRequestFactory
@Override
protected ClientHttpResponse executeInternal(HttpHeaders headers)
throws IOException {
// use execute here so stats are collected
return loadBalancer.execute(this.config.getClientName(), new LoadBalancerRequest<ClientHttpResponse>() {
try {
HttpResponse response = client.execute(request, config);
return new RibbonHttpResponse(response);
} catch (Exception e) {
throw new IOException(e);
}
//TODO: fix stats, now that execute is not called
// use execute here so stats are collected
/*return loadBalancer.execute(this.config.getClientName(), new LoadBalancerRequest<ClientHttpResponse>() {
@Override
public ClientHttpResponse apply(ServiceInstance instance) throws Exception {
HttpResponse response = client.execute(request, config);
return new RibbonHttpResponse(response);
}
});
});*/
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment