Migrate ServerEventNotifier.OnTaskCompleted to IEventConsumer

This commit is contained in:
Patrick Barron
2020-08-15 18:16:41 -04:00
parent a0453a0fe6
commit 5282a5c8c2
2 changed files with 31 additions and 17 deletions

View File

@@ -25,11 +25,6 @@ namespace Emby.Server.Implementations.EntryPoints
/// </summary>
private readonly IServerApplicationHost _appHost;
/// <summary>
/// The task manager.
/// </summary>
private readonly ITaskManager _taskManager;
private readonly ISessionManager _sessionManager;
/// <summary>
@@ -37,17 +32,14 @@ namespace Emby.Server.Implementations.EntryPoints
/// </summary>
/// <param name="appHost">The application host.</param>
/// <param name="installationManager">The installation manager.</param>
/// <param name="taskManager">The task manager.</param>
/// <param name="sessionManager">The session manager.</param>
public ServerEventNotifier(
IServerApplicationHost appHost,
IInstallationManager installationManager,
ITaskManager taskManager,
ISessionManager sessionManager)
{
_installationManager = installationManager;
_appHost = appHost;
_taskManager = taskManager;
_sessionManager = sessionManager;
}
@@ -62,8 +54,6 @@ namespace Emby.Server.Implementations.EntryPoints
_installationManager.PackageInstallationCompleted += OnPackageInstallationCompleted;
_installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
_taskManager.TaskCompleted += OnTaskCompleted;
return Task.CompletedTask;
}
@@ -87,11 +77,6 @@ namespace Emby.Server.Implementations.EntryPoints
await SendMessageToAdminSessions("PackageInstallationFailed", e.InstallationInfo).ConfigureAwait(false);
}
private async void OnTaskCompleted(object sender, TaskCompletionEventArgs e)
{
await SendMessageToAdminSessions("ScheduledTaskEnded", e.Result).ConfigureAwait(false);
}
/// <summary>
/// Installations the manager_ plugin uninstalled.
/// </summary>
@@ -145,8 +130,6 @@ namespace Emby.Server.Implementations.EntryPoints
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
_appHost.HasPendingRestartChanged -= OnHasPendingRestartChanged;
_taskManager.TaskCompleted -= OnTaskCompleted;
}
}
}