Skip to content

Commit

Permalink
fixed setting custom timeout value (JENKINS-29719)
Browse files Browse the repository at this point in the history
fixed issue https://issues.jenkins-ci.org/browse/JENKINS-29719
it is possible now to set custom request timeout.
code on the line 91 doesn't do it (I don't understand why)
  • Loading branch information
wowandos26 committed Jun 23, 2017
1 parent 06bff90 commit 9433eae
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -38,6 +38,7 @@
import com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials;
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.Response;
import hudson.model.TaskListener;
import hudson.util.LogTaskListener;
Expand Down Expand Up @@ -73,7 +74,14 @@ public static <T> T execute(PackageManagerClientCallable<T> callable, GraniteCli
TaskListener _listener) throws Exception {
final TaskListener listener = _listener != null ? _listener : DEFAULT_LISTENER;

final AsyncHttpClient ahcClient = config.getGlobalConfig().getInstance();
final GraniteClientGlobalConfig globalConfig = config.getGlobalConfig();
final AsyncHttpClient ahcClient = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setProxyServer(globalConfig.getProxyServer())
.setConnectTimeout(globalConfig.getConnectionTimeoutInMs())
.setReadTimeout(config.getServiceTimeout() > 0 ? (int) config.getServiceTimeout() : globalConfig.getIdleConnectionTimeoutInMs())
.setRequestTimeout(config.getRequestTimeout() > 0 ? (int) config.getRequestTimeout() : globalConfig.getRequestTimeoutInMs())
.build()
);

try {
AsyncPackageManagerClient client = new AsyncPackageManagerClient(ahcClient);

Expand Down

0 comments on commit 9433eae

Please sign in to comment.