skip when URL is in failure cache

cache proxy failures (404) for better performances

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@610758 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas De Loof 2008-01-10 11:00:35 +00:00
parent 75a2efd2dd
commit 679b8921cd
1 changed files with 11 additions and 3 deletions

View File

@ -524,10 +524,15 @@ public class DefaultRepositoryProxyConnectors
getLogger().info( emsg ); getLogger().info( emsg );
return null; return null;
} }
if ( urlFailureCache.hasFailedBefore( url ) )
{
throw new NotFoundException( "Url has failed before and cache-failure is enabled on this connector" );
}
Wagon wagon = null; Wagon wagon = null;
try try
{ {
RepositoryURL repoUrl = remoteRepository.getURL(); RepositoryURL repoUrl = remoteRepository.getURL();
String protocol = repoUrl.getProtocol(); String protocol = repoUrl.getProtocol();
wagon = (Wagon) wagons.get( protocol ); wagon = (Wagon) wagons.get( protocol );
@ -547,7 +552,10 @@ public class DefaultRepositoryProxyConnectors
} }
catch ( NotFoundException e ) catch ( NotFoundException e )
{ {
// Do not cache url here. // public repositories may be slow to access, and many request will fail when
// muliple repositories are "merged" by archiva via proxies.
// so caching "not found" is usefull here to enhance archiva response-time
urlFailureCache.cacheFailure( url );
throw e; throw e;
} }
catch ( NotModifiedException e ) catch ( NotModifiedException e )