]> source.dussan.org Git - archiva.git/commitdiff
Increasing timeouts for repository check 23/head
authorMartin Stockhammer <m.stockhammer@web.de>
Thu, 8 Sep 2016 17:00:40 +0000 (19:00 +0200)
committerMartin Stockhammer <m.stockhammer@web.de>
Thu, 8 Sep 2016 17:00:40 +0000 (19:00 +0200)
Slow responding repositories were marked with a repository failure because of the
low read timeout value.
Increases the timeout for the repository check.

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java

index c3528eb4b51be38e4508c651d0978a5b13c74b71..9c0bdd925bd8591bdc1eee5786802ba21f364eee 100644 (file)
@@ -64,6 +64,9 @@ public class DefaultRemoteRepositoriesService
     @Inject
     private NetworkProxyAdmin networkProxyAdmin;
 
+    int checkReadTimeout = 10000;
+    int checkTimeout = 9000;
+
     @Override
     public List<RemoteRepository> getRemoteRepositories()
         throws ArchivaRestServiceException
@@ -172,14 +175,14 @@ public class DefaultRemoteRepositoriesService
                                            .networkProxy( networkProxy ) );
 
             // hardcoded value as it's a check of the remote repo connectivity
-            wagon.setReadTimeout( 4000 );
-            wagon.setTimeout( 3000 );
+            wagon.setReadTimeout( checkReadTimeout );
+            wagon.setTimeout( checkTimeout );
 
             if ( wagon instanceof AbstractHttpClientWagon )
             {
                 HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration() //
                     .setUsePreemptive( true ) //
-                    .setReadTimeout( 4000 );
+                    .setReadTimeout( checkReadTimeout );
                 HttpConfiguration httpConfiguration = new HttpConfiguration().setGet( httpMethodConfiguration );
                 AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration );
             }
@@ -214,4 +217,20 @@ public class DefaultRemoteRepositoriesService
         }
 
     }
+
+    public int getCheckReadTimeout() {
+        return checkReadTimeout;
+    }
+
+    public void setCheckReadTimeout(int checkReadTimeout) {
+        this.checkReadTimeout = checkReadTimeout;
+    }
+
+    public int getCheckTimeout() {
+        return checkTimeout;
+    }
+
+    public void setCheckTimeout(int checkTimeout) {
+        this.checkTimeout = checkTimeout;
+    }
 }