From 6e118e33f2430fdbe7a17784c77a3d5eb88c69fd Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 16 Jun 2015 12:01:46 -0700 Subject: [PATCH] Extend lifetime of v3 feed detection HTTP cache --- .../Restore/NuGet/NuGetv3Feed.cs | 5 +++-- .../Utils/PackageSourceUtils.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Framework.PackageManager/Restore/NuGet/NuGetv3Feed.cs b/src/Microsoft.Framework.PackageManager/Restore/NuGet/NuGetv3Feed.cs index 9c58cebaf..8e62614ee 100644 --- a/src/Microsoft.Framework.PackageManager/Restore/NuGet/NuGetv3Feed.cs +++ b/src/Microsoft.Framework.PackageManager/Restore/NuGet/NuGetv3Feed.cs @@ -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); diff --git a/src/Microsoft.Framework.PackageManager/Utils/PackageSourceUtils.cs b/src/Microsoft.Framework.PackageManager/Utils/PackageSourceUtils.cs index af25419cb..a6bc54e9a 100644 --- a/src/Microsoft.Framework.PackageManager/Utils/PackageSourceUtils.cs +++ b/src/Microsoft.Framework.PackageManager/Utils/PackageSourceUtils.cs @@ -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) {