mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
chore: change caching behaviour for pluginmasters
This commit is contained in:
parent
9a5e3bcf22
commit
417862765a
1 changed files with 14 additions and 3 deletions
|
|
@ -1,11 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Logging.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Utility;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Plugin.Internal
|
||||
|
|
@ -19,6 +20,17 @@ namespace Dalamud.Plugin.Internal
|
|||
|
||||
private static readonly ModuleLog Log = new("PLUGINR");
|
||||
|
||||
private static HttpClient HttpClient = new()
|
||||
{
|
||||
DefaultRequestHeaders =
|
||||
{
|
||||
CacheControl = new CacheControlHeaderValue
|
||||
{
|
||||
NoCache = true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginRepository"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -74,8 +86,7 @@ namespace Dalamud.Plugin.Internal
|
|||
{
|
||||
Log.Information($"Fetching repo: {this.PluginMasterUrl}");
|
||||
|
||||
// ?ticks causes a cache invalidation. Get a fresh repo every time.
|
||||
using var response = await Util.HttpClient.GetAsync(this.PluginMasterUrl + "?" + DateTime.Now.Ticks);
|
||||
using var response = await HttpClient.GetAsync(this.PluginMasterUrl);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var data = await response.Content.ReadAsStringAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue