From 417862765a6cd972d3c3917c4bb6d4cdb47a255e Mon Sep 17 00:00:00 2001 From: goaaats Date: Sun, 17 Apr 2022 15:10:29 +0200 Subject: [PATCH] chore: change caching behaviour for pluginmasters --- Dalamud/Plugin/Internal/PluginRepository.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Dalamud/Plugin/Internal/PluginRepository.cs b/Dalamud/Plugin/Internal/PluginRepository.cs index 55b77ce49..47dc962e6 100644 --- a/Dalamud/Plugin/Internal/PluginRepository.cs +++ b/Dalamud/Plugin/Internal/PluginRepository.cs @@ -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, + }, + }, + }; + /// /// Initializes a new instance of the class. /// @@ -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();