From bd07ace6fb0d709a4fd585f82274e2bc5dc12347 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sun, 22 Dec 2013 12:26:20 +0000 Subject: [PATCH] fix timeout git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1552985 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultRemoteRepositoriesService.java | 9 ++++---- .../apache/archiva/i18n/default.properties | 2 +- .../admin/repository/maven2/repositories.js | 22 ++++++++++--------- .../js/templates/archiva/repositories.html | 2 -- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java index 5e83622a0..fd6c1a7ca 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java @@ -171,15 +171,16 @@ public class DefaultRemoteRepositoriesService new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders() ).networkProxy( networkProxy ) ); - wagon.setReadTimeout( remoteRepository.getRemoteDownloadTimeout() * 1000 ); - wagon.setTimeout( remoteRepository.getTimeout() * 1000 ); - HttpWagon foo; + // hardcoded value as it's a check of the remote repo connectivity + wagon.setReadTimeout( 4000 ); + wagon.setTimeout( 3000 ); + if ( wagon instanceof AbstractHttpClientWagon ) { HttpConfiguration httpConfiguration = new HttpConfiguration(); HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration(); httpMethodConfiguration.setUsePreemptive( true ); - httpMethodConfiguration.setReadTimeout( remoteRepository.getRemoteDownloadTimeout() * 1000 ); + httpMethodConfiguration.setReadTimeout( 4000 ); httpConfiguration.setGet( httpMethodConfiguration ); AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration ); } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index be56ca1f8..d1eda6f41 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -196,7 +196,7 @@ remoteRepository.extraParametersEntries.help.title=Extra Url Parameters remoteRepository.extraParametersEntries.help.content=Key/Value pair you want to add to the url when asking the remote repository. remoteRepository.extraHeadersEntries.help.title=Extra HTTP Headers remoteRepository.extraHeadersEntries.help.content=Key/Value pair HTTP headers you want to add when asking the remote repository. - +remoterepository.remotecheck=Remote Check diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js index eaba06d9c..6ccf740e5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js @@ -1224,16 +1224,18 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { var repoId = $( this ).attr("id"); console.log( index + ": " + repoId); $.ajax({ - url: "restServices/archivaServices/remoteRepositoriesService/checkRemoteConnectivity/"+repoId.substringAfterFirst("remote-check-"), - type: "GET", - success: function(result){ - if(result="true"){ - mainContent.find("img[id='"+repoId+"']").attr("src", "images/weather-clear.png" ) - } else { - mainContent.find("img[id='"+repoId+"']").attr("src", "images/weather-severe-alert-16-16.png" ) - } - } - }) + url: "restServices/archivaServices/remoteRepositoriesService/checkRemoteConnectivity/"+repoId.substringAfterFirst("remote-check-"), + type: "GET", + dataType: 'text', + success: function(result){ + $.log("result:"+result); + if(result=="true"){ + mainContent.find("img[id='"+repoId+"']").attr("src", "images/weather-clear.png" ) + } else { + mainContent.find("img[id='"+repoId+"']").attr("src", "images/weather-severe-alert-16-16.png" ) + } + } + }); }); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html index e3639e47c..f7fe3f042 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html @@ -534,8 +534,6 @@ - weather-severe-alert-16-16.png - {{/each}} -- 2.39.5