From 0926f47396ed647305c6c7963c0b7865e41af0f2 Mon Sep 17 00:00:00 2001 From: anurse Date: Mon, 3 Feb 2014 14:56:54 -0800 Subject: [PATCH] Added more connection timeout logic to GetPackage --- src/NuGetGallery/Controllers/ApiController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NuGetGallery/Controllers/ApiController.cs b/src/NuGetGallery/Controllers/ApiController.cs index 2a47043a84..cffc274185 100644 --- a/src/NuGetGallery/Controllers/ApiController.cs +++ b/src/NuGetGallery/Controllers/ApiController.cs @@ -96,6 +96,9 @@ public virtual async Task GetPackage(string id, string version) // The allow prerelease flag is ignored if both partialId and version are specified. // In general we want to try to add download statistics for any package regardless of whether a version was specified. + // Only allow database requests to take up to 5 seconds. Any longer and we just lose the data; oh well. + EntitiesContext.SetCommandTimeout(5); + Package package = null; try { @@ -118,9 +121,6 @@ public virtual async Task GetPackage(string id, string version) ProjectGuids = Request.Headers["NuGet-ProjectGuids"], }; - // Only allow this to take up to 5 seconds. Any longer and we just lose the data; oh well. - EntitiesContext.SetCommandTimeout(5); - PackageService.AddDownloadStatistics(stats); } catch (ReadOnlyModeException)