chore: lock plugin lists when applying profile want state

This commit is contained in:
goat 2023-06-19 20:04:59 +02:00
parent 10276a651d
commit 3d47e05ab0
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
2 changed files with 5 additions and 3 deletions

View file

@ -162,7 +162,7 @@ internal partial class PluginManager : IDisposable, IServiceType
} }
/// <summary> /// <summary>
/// Gets a list of all available plugins. /// Gets a copy of the list of all available plugins.
/// </summary> /// </summary>
public IEnumerable<RemotePluginManifest> AvailablePlugins public IEnumerable<RemotePluginManifest> AvailablePlugins
{ {
@ -176,7 +176,7 @@ internal partial class PluginManager : IDisposable, IServiceType
} }
/// <summary> /// <summary>
/// Gets a list of all plugins with an available update. /// Gets a copy of the list of all plugins with an available update.
/// </summary> /// </summary>
public IEnumerable<AvailablePluginUpdate> UpdatablePlugins public IEnumerable<AvailablePluginUpdate> UpdatablePlugins
{ {

View file

@ -169,6 +169,9 @@ internal class ProfileManager : IServiceType
/// </summary> /// </summary>
public void ApplyAllWantStates() public void ApplyAllWantStates()
{ {
var pm = Service<PluginManager>.Get();
using var pmLock = pm.LockPluginLists();
this.isBusy = true; this.isBusy = true;
Log.Information("Getting want states..."); Log.Information("Getting want states...");
@ -185,7 +188,6 @@ internal class ProfileManager : IServiceType
Log.Information("Applying want states..."); Log.Information("Applying want states...");
var pm = Service<PluginManager>.Get();
var tasks = new List<Task>(); var tasks = new List<Task>();
foreach (var installedPlugin in pm.InstalledPlugins) foreach (var installedPlugin in pm.InstalledPlugins)