diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs index 66a4d48..1195e54 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs @@ -84,6 +84,13 @@ public class Entrypoint : IHostedService, IDisposable /// public Task StopAsync(CancellationToken cancellationToken) { + _libraryManager.ItemAdded -= OnItemAdded; + _libraryManager.ItemUpdated -= OnItemModified; + _taskManager.TaskCompleted -= OnLibraryRefresh; + + // Stop the timer + _queueTimer.Change(Timeout.Infinite, 0); + return Task.CompletedTask; } @@ -283,10 +290,6 @@ public class Entrypoint : IHostedService, IDisposable { if (!dispose) { - _libraryManager.ItemAdded -= OnItemAdded; - _libraryManager.ItemUpdated -= OnItemModified; - _taskManager.TaskCompleted -= OnLibraryRefresh; - _queueTimer.Dispose(); return; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/PluginServiceRegistrator.cs b/ConfusedPolarBear.Plugin.IntroSkipper/PluginServiceRegistrator.cs index 6bc818c..2f3459a 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/PluginServiceRegistrator.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/PluginServiceRegistrator.cs @@ -13,6 +13,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost) { serviceCollection.AddHostedService(); + serviceCollection.AddHostedService(); } } }