Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Extend lifetime of v3 feed detection HTTP cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengTian committed Jun 17, 2015
1 parent 79dfa90 commit 6e118e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ internal NuGetv3Feed(
}
}

internal static bool DetectNuGetV3(HttpSource httpSource, out Uri packageBaseAddress)
internal static bool DetectNuGetV3(HttpSource httpSource, bool noCache, out Uri packageBaseAddress)
{
var cacheAgeLimit = noCache ? TimeSpan.Zero : TimeSpan.FromDays(7);
try
{
var result = httpSource.GetAsync(httpSource.BaseUri, "index_json", TimeSpan.FromHours(6)).Result;
var result = httpSource.GetAsync(httpSource.BaseUri, "index_json", cacheAgeLimit).Result;
using (var reader = new JsonTextReader(new StreamReader(result.Stream)))
{
var indexJson = JObject.Load(reader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static IPackageFeed CreatePackageFeed(PackageSource source, bool noCache,
reports);

Uri packageBaseAddress;
if (NuGetv3Feed.DetectNuGetV3(httpSource, out packageBaseAddress))
if (NuGetv3Feed.DetectNuGetV3(httpSource, noCache, out packageBaseAddress))
{
if (packageBaseAddress == null)
{
Expand Down

0 comments on commit 6e118e3

Please sign in to comment.