diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-08-15 23:12:34 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-08-15 23:12:34 -0400 |
| commit | 25437af594bbac517ab3a9bfef26e2b4af7ee899 (patch) | |
| tree | a9815037fa349c188c901887271ddd69d212e643 | |
| parent | 4478945e20e0861c720a1035778f3f13be90226d (diff) | |
Migrate ServerEventNotifier.OnPackageInstallationFailed to IEventConsumer
| -rw-r--r-- | Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs | 7 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/Events/Consumers/Updates/PluginInstallationFailedNotifier.cs | 31 |
2 files changed, 31 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs index 247bb87c7..549e1d569 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.EntryPoints await 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.cs new file mode 100644 index 000000000..ea0c878d4 --- /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); + } + } +} |
