fix: PM.ReposReady now also includes the time needed for filtering

This commit is contained in:
goat 2023-06-20 22:47:29 +02:00
parent 5d5af70e21
commit a954e83976
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -202,7 +202,7 @@ internal partial class PluginManager : IDisposable, IServiceType
/// <summary>
/// Gets a value indicating whether all added repos are not in progress.
/// </summary>
public bool ReposReady => this.Repos.All(repo => repo.State != PluginRepositoryState.InProgress);
public bool ReposReady { get; private set; }
/// <summary>
/// Gets a value indicating whether the plugin manager started in safe mode.
@ -649,7 +649,10 @@ internal partial class PluginManager : IDisposable, IServiceType
public async Task ReloadPluginMastersAsync(bool notify = true)
{
Log.Information("Now reloading all PluginMasters...");
this.ReposReady = false;
try
{
Debug.Assert(!this.Repos.First().IsThirdParty, "First repository should be main repository");
await this.Repos.First().ReloadPluginMasterAsync(); // Load official repo first
@ -659,6 +662,15 @@ internal partial class PluginManager : IDisposable, IServiceType
this.RefilterPluginMasters(notify);
}
catch (Exception ex)
{
Log.Error(ex, "Could not reload plugin repositories");
}
finally
{
this.ReposReady = true;
}
}
/// <summary>
/// Apply visibility and eligibility filters to the available plugins, then event that the list has updated.