mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
fix: reuse HttpClient for icon/image downloads
This commit is contained in:
parent
3985d3eadd
commit
2d3e225e2c
1 changed files with 4 additions and 6 deletions
|
|
@ -49,6 +49,8 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
private readonly TextureWrap troubleIcon;
|
private readonly TextureWrap troubleIcon;
|
||||||
private readonly TextureWrap updateIcon;
|
private readonly TextureWrap updateIcon;
|
||||||
|
|
||||||
|
private readonly HttpClient httpClient = new();
|
||||||
|
|
||||||
#region Image Tester State
|
#region Image Tester State
|
||||||
|
|
||||||
private string[] testerImagePaths = new string[5];
|
private string[] testerImagePaths = new string[5];
|
||||||
|
|
@ -1743,11 +1745,9 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
Log.Verbose($"Icon from {url}");
|
Log.Verbose($"Icon from {url}");
|
||||||
|
|
||||||
var client = new HttpClient();
|
|
||||||
|
|
||||||
if (url != null)
|
if (url != null)
|
||||||
{
|
{
|
||||||
var data = await client.GetAsync(url);
|
var data = await this.httpClient.GetAsync(url);
|
||||||
if (data.StatusCode == HttpStatusCode.NotFound)
|
if (data.StatusCode == HttpStatusCode.NotFound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1782,8 +1782,6 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
this.pluginImagesMap.Add(manifest.InternalName, (false, null));
|
this.pluginImagesMap.Add(manifest.InternalName, (false, null));
|
||||||
|
|
||||||
var client = new HttpClient();
|
|
||||||
|
|
||||||
var urls = GetPluginImageUrls(manifest, isThirdParty, pluginManager.UseTesting(manifest));
|
var urls = GetPluginImageUrls(manifest, isThirdParty, pluginManager.UseTesting(manifest));
|
||||||
var didAny = false;
|
var didAny = false;
|
||||||
|
|
||||||
|
|
@ -1798,7 +1796,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
var pluginImages = new TextureWrap[urls.Count];
|
var pluginImages = new TextureWrap[urls.Count];
|
||||||
for (var i = 0; i < urls.Count; i++)
|
for (var i = 0; i < urls.Count; i++)
|
||||||
{
|
{
|
||||||
var data = await client.GetAsync(urls[i]);
|
var data = await this.httpClient.GetAsync(urls[i]);
|
||||||
|
|
||||||
Serilog.Log.Information($"Download from {urls[i]}");
|
Serilog.Log.Information($"Download from {urls[i]}");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue