mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Dalamud.Logging.Internal;
|
using Dalamud.Logging.Internal;
|
||||||
using Dalamud.Plugin.Internal.Types;
|
using Dalamud.Plugin.Internal.Types;
|
||||||
using Dalamud.Utility;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Dalamud.Plugin.Internal
|
namespace Dalamud.Plugin.Internal
|
||||||
|
|
@ -19,6 +20,17 @@ namespace Dalamud.Plugin.Internal
|
||||||
|
|
||||||
private static readonly ModuleLog Log = new("PLUGINR");
|
private static readonly ModuleLog Log = new("PLUGINR");
|
||||||
|
|
||||||
|
private static HttpClient HttpClient = new()
|
||||||
|
{
|
||||||
|
DefaultRequestHeaders =
|
||||||
|
{
|
||||||
|
CacheControl = new CacheControlHeaderValue
|
||||||
|
{
|
||||||
|
NoCache = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PluginRepository"/> class.
|
/// Initializes a new instance of the <see cref="PluginRepository"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -74,8 +86,7 @@ namespace Dalamud.Plugin.Internal
|
||||||
{
|
{
|
||||||
Log.Information($"Fetching repo: {this.PluginMasterUrl}");
|
Log.Information($"Fetching repo: {this.PluginMasterUrl}");
|
||||||
|
|
||||||
// ?ticks causes a cache invalidation. Get a fresh repo every time.
|
using var response = await HttpClient.GetAsync(this.PluginMasterUrl);
|
||||||
using var response = await Util.HttpClient.GetAsync(this.PluginMasterUrl + "?" + DateTime.Now.Ticks);
|
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
var data = await response.Content.ReadAsStringAsync();
|
var data = await response.Content.ReadAsStringAsync();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue