Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: Optimize xrefmap download performance #9637

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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