diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-08-15 18:33:30 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-08-15 18:33:30 -0400 |
| commit | dc88e93504a98a377881f7425ffba5d2221fada0 (patch) | |
| tree | ae9f241b6e6c0c229607daccfd16e9c677d7d8b5 /Jellyfin.Server.Implementations/Events | |
| parent | 5282a5c8c2224ec36121cdf99ef2a14f7d703973 (diff) | |
Migrate ServerEventNotifier.OnHasPendingRestartChanged to IEventConsumer
Diffstat (limited to 'Jellyfin.Server.Implementations/Events')
| -rw-r--r-- | Jellyfin.Server.Implementations/Events/Consumers/System/PendingRestartNotifier.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/Events/Consumers/System/PendingRestartNotifier.cs b/Jellyfin.Server.Implementations/Events/Consumers/System/PendingRestartNotifier.cs new file mode 100644 index 000000000..2fa38dd71 --- /dev/null +++ b/Jellyfin.Server.Implementations/Events/Consumers/System/PendingRestartNotifier.cs @@ -0,0 +1,31 @@ +using System.Threading; +using System.Threading.Tasks; +using Jellyfin.Data.Events.System; +using MediaBrowser.Controller.Events; +using MediaBrowser.Controller.Session; + +namespace Jellyfin.Server.Implementations.Events.Consumers.System +{ + /// <summary> + /// Notifies users when there is a pending restart. + /// </summary> + public class PendingRestartNotifier : IEventConsumer<PendingRestartEventArgs> + { + private readonly ISessionManager _sessionManager; + + /// <summary> + /// Initializes a new instance of the <see cref="PendingRestartNotifier"/> class. + /// </summary> + /// <param name="sessionManager">The session manager.</param> + public PendingRestartNotifier(ISessionManager sessionManager) + { + _sessionManager = sessionManager; + } + + /// <inheritdoc /> + public async Task OnEvent(PendingRestartEventArgs eventArgs) + { + await _sessionManager.SendRestartRequiredNotification(CancellationToken.None).ConfigureAwait(false); + } + } +} |
