Skip to content

Commit

Permalink
pref: optimize xrefmap download perforamance
Browse files Browse the repository at this point in the history
  • Loading branch information
filzrev committed Jan 23, 2024
1 parent 1c9863f commit 7e13411
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Docfx.Build/XRefMaps/XRefMapDownloader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Net;
using Docfx.Common;

using EnvironmentVariables = Docfx.DataContracts.Common.Constants.EnvironmentVariables;
Expand Down Expand Up @@ -127,11 +128,15 @@ protected static async Task<XRefMap> DownloadFromWebAsync(Uri uri)

using var httpClient = new HttpClient(new HttpClientHandler()
{
AutomaticDecompression = DecompressionMethods.All,
CheckCertificateRevocationList = !EnvironmentVariables.NoCheckCertificateRevocationList,
});
})
{
Timeout = TimeSpan.FromMinutes(30), // Default: 100 seconds
};

using var stream = await httpClient.GetStreamAsync(uri);
using var sr = new StreamReader(stream);
using var sr = new StreamReader(stream, bufferSize: 81920); // Default :1024 byte
var map = YamlUtility.Deserialize<XRefMap>(sr);
map.BaseUrl = baseUrl;
UpdateHref(map, null);
Expand Down

0 comments on commit 7e13411

Please sign in to comment.