Use IHostLifetime to handle restarting and shutting down

This commit is contained in:
Patrick Barron
2023-09-22 21:10:49 -04:00
parent 1d8c3e088b
commit 493de3297a
10 changed files with 98 additions and 298 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
namespace MediaBrowser.Common
@@ -42,10 +41,15 @@ namespace MediaBrowser.Common
bool HasPendingRestart { get; }
/// <summary>
/// Gets a value indicating whether this instance is currently shutting down.
/// Gets or sets a value indicating whether this instance is currently shutting down.
/// </summary>
/// <value><c>true</c> if this instance is shutting down; otherwise, <c>false</c>.</value>
bool IsShuttingDown { get; }
bool IsShuttingDown { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the application should restart.
/// </summary>
bool ShouldRestart { get; set; }
/// <summary>
/// Gets the application version.
@@ -87,11 +91,6 @@ namespace MediaBrowser.Common
/// </summary>
void NotifyPendingRestart();
/// <summary>
/// Restarts this instance.
/// </summary>
void Restart();
/// <summary>
/// Gets the exports.
/// </summary>
@@ -123,12 +122,6 @@ namespace MediaBrowser.Common
/// <returns>``0.</returns>
T Resolve<T>();
/// <summary>
/// Shuts down.
/// </summary>
/// <returns>A task.</returns>
Task Shutdown();
/// <summary>
/// Initializes this instance.
/// </summary>

View File

@@ -29,11 +29,6 @@ namespace MediaBrowser.Common.Plugins
/// <returns>An IEnumerable{Assembly}.</returns>
IEnumerable<Assembly> LoadAssemblies();
/// <summary>
/// Unloads all of the assemblies.
/// </summary>
void UnloadAssemblies();
/// <summary>
/// Registers the plugin's services with the DI.
/// Note: DI is not yet instantiated yet.