Skip to content

Commit

Permalink
Merge pull request #7 from wowandos26/master
Browse files Browse the repository at this point in the history
fixed setting custom timeout value (JENKINS-29719)
  • Loading branch information
adamcin committed Jun 23, 2017
2 parents 06bff90 + 9433eae commit 76430f5
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 76430f5

Please sign in to comment.