@@ -14,6 +14,14 @@ internal class DefaultRegistryAPI : IRegistryAPI
14
14
private readonly HttpClient _client ;
15
15
private readonly ILogger _logger ;
16
16
17
+ // Empirical value - Unoptimized .NET application layers can be ~200MB
18
+ // * .NET Runtime (~80MB)
19
+ // * ASP.NET Runtime (~25MB)
20
+ // * application and dependencies - variable, but _probably_ not more than the BCL?
21
+ // Given a 200MB target and a 1Mb/s upload speed, we'd expect an upload speed of 27m:57s.
22
+ // Making this a round 30 for convenience.
23
+ private static TimeSpan LongRequestTimeout = TimeSpan . FromMinutes ( 30 ) ;
24
+
17
25
internal DefaultRegistryAPI ( string registryName , Uri baseUri , ILogger logger )
18
26
{
19
27
bool isAmazonECRRegistry = baseUri . IsAmazonECRRegistry ( ) ;
@@ -33,7 +41,7 @@ private static HttpClient CreateClient(string registryName, Uri baseUri, ILogger
33
41
var innerHandler = new SocketsHttpHandler ( )
34
42
{
35
43
UseCookies = false ,
36
- // the rest of the HTTP stack has an infinite timeout (see below) but we should still have a reasonable timeout for the initial connection
44
+ // the rest of the HTTP stack has an very long timeout (see below) but we should still have a reasonable timeout for the initial connection
37
45
ConnectTimeout = TimeSpan . FromSeconds ( 30 )
38
46
} ;
39
47
@@ -56,8 +64,7 @@ private static HttpClient CreateClient(string registryName, Uri baseUri, ILogger
56
64
57
65
HttpClient client = new ( clientHandler )
58
66
{
59
- // blob upload operations can take quite a while, we should allow them to take as long as they need
60
- Timeout = Timeout . InfiniteTimeSpan
67
+ Timeout = LongRequestTimeout
61
68
} ;
62
69
63
70
client . DefaultRequestHeaders . Add ( "User-Agent" , $ ".NET Container Library v{ Constants . Version } ") ;
0 commit comments