From a954e839764f00973268c1f4207db1efbb2256f5 Mon Sep 17 00:00:00 2001 From: goat Date: Tue, 20 Jun 2023 22:47:29 +0200 Subject: [PATCH] fix: PM.ReposReady now also includes the time needed for filtering --- Dalamud/Plugin/Internal/PluginManager.cs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 9b407d724..ccb54cc99 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -202,7 +202,7 @@ internal partial class PluginManager : IDisposable, IServiceType /// /// Gets a value indicating whether all added repos are not in progress. /// - public bool ReposReady => this.Repos.All(repo => repo.State != PluginRepositoryState.InProgress); + public bool ReposReady { get; private set; } /// /// Gets a value indicating whether the plugin manager started in safe mode. @@ -649,15 +649,27 @@ internal partial class PluginManager : IDisposable, IServiceType public async Task ReloadPluginMastersAsync(bool notify = true) { Log.Information("Now reloading all PluginMasters..."); + this.ReposReady = false; - Debug.Assert(!this.Repos.First().IsThirdParty, "First repository should be main repository"); - await this.Repos.First().ReloadPluginMasterAsync(); // Load official repo first + try + { + Debug.Assert(!this.Repos.First().IsThirdParty, "First repository should be main repository"); + await this.Repos.First().ReloadPluginMasterAsync(); // Load official repo first - await Task.WhenAll(this.Repos.Skip(1).Select(repo => repo.ReloadPluginMasterAsync())); + await Task.WhenAll(this.Repos.Skip(1).Select(repo => repo.ReloadPluginMasterAsync())); - Log.Information("PluginMasters reloaded, now refiltering..."); + Log.Information("PluginMasters reloaded, now refiltering..."); - this.RefilterPluginMasters(notify); + this.RefilterPluginMasters(notify); + } + catch (Exception ex) + { + Log.Error(ex, "Could not reload plugin repositories"); + } + finally + { + this.ReposReady = true; + } } ///