The Free Software Media System - Server Backend & API
Migrate ServerEventNotifier.OnPackageInstallationFailed to IEventConsumer
Patrick Barron25437af594bb
diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.csindex 247bb87c75..549e1d5690 100644--- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs@@ -38,7 +38,6 @@ namespace Emby.Server.Implementations.EntryPoints{_installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;_installationManager.PackageInstallationCompleted += OnPackageInstallationCompleted;- _installationManager.PackageInstallationFailed += OnPackageInstallationFailed;return Task.CompletedTask;}@@ -53,11 +52,6 @@ namespace Emby.Server.Implementations.EntryPointsawait SendMessageToAdminSessions("PackageInstallationCompleted", e).ConfigureAwait(false);}- private async void OnPackageInstallationFailed(object sender, InstallationFailedEventArgs e)- {- await SendMessageToAdminSessions("PackageInstallationFailed", e.InstallationInfo).ConfigureAwait(false);- }-private async Task SendMessageToAdminSessions<T>(string name, T data){try@@ -86,7 +80,6 @@ namespace Emby.Server.Implementations.EntryPoints{_installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;_installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;- _installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;}}}diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedNotifier.cs b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedNotifier.csnew file mode 100644index 0000000000..ea0c878d42--- /dev/null+++ b/Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedNotifier.cs@@ -0,0 +1,31 @@+using System.Threading;+using System.Threading.Tasks;+using MediaBrowser.Common.Updates;+using MediaBrowser.Controller.Events;+using MediaBrowser.Controller.Session;++namespace Jellyfin.Server.Implementations.Events.Consumers.Updates+{+ /// <summary>+ /// Notifies admin users when a plugin installation fails.+ /// </summary>+ public class PluginInstallationFailedNotifier : IEventConsumer<InstallationFailedEventArgs>+ {+ private readonly ISessionManager _sessionManager;++ /// <summary>+ /// Initializes a new instance of the <see cref="PluginInstallationFailedNotifier"/> class.+ /// </summary>+ /// <param name="sessionManager">The session manager.</param>+ public PluginInstallationFailedNotifier(ISessionManager sessionManager)+ {+ _sessionManager = sessionManager;+ }++ /// <inheritdoc />+ public async Task OnEvent(InstallationFailedEventArgs eventArgs)+ {+ await _sessionManager.SendMessageToAdminSessions("PackageInstallationFailed", eventArgs.InstallationInfo, CancellationToken.None).ConfigureAwait(false);+ }+ }+}