From ad9d36ebd6b50ab66d800eabd87bc1cbbf125beb Mon Sep 17 00:00:00 2001
From: rlauuzo <46294892+rlauuzo@users.noreply.github.com>
Date: Mon, 23 Sep 2024 18:48:26 +0200
Subject: [PATCH] Update Entrypoint.cs
---
.../Services/Entrypoint.cs | 31 +++----------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs
index f14873e..6d2363c 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs
@@ -16,7 +16,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper;
///
/// Server entrypoint.
///
-public class Entrypoint : IHostedService, IDisposable
+public sealed class Entrypoint : IHostedService, IDisposable
{
private readonly ITaskManager _taskManager;
private readonly ILibraryManager _libraryManager;
@@ -25,7 +25,6 @@ public class Entrypoint : IHostedService, IDisposable
private readonly HashSet _seasonsToAnalyze = [];
private readonly Timer _queueTimer;
private static readonly ManualResetEventSlim _autoTaskCompletEvent = new(false);
- private bool _disposed;
private bool _analyzeAgain;
private static CancellationTokenSource? _cancellationTokenSource;
@@ -313,31 +312,11 @@ public class Entrypoint : IHostedService, IDisposable
_autoTaskCompletEvent.Wait(TimeSpan.FromSeconds(60), cancellationToken); // Wait for the signal
}
- ///
- /// Dispose.
- ///
+ ///
public void Dispose()
{
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- ///
- /// Protected dispose.
- ///
- /// Dispose.
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposed)
- {
- if (disposing)
- {
- _queueTimer.Dispose();
- _cancellationTokenSource?.Dispose();
- _autoTaskCompletEvent.Dispose();
- }
-
- _disposed = true;
- }
+ _queueTimer.Dispose();
+ _cancellationTokenSource?.Dispose();
+ _autoTaskCompletEvent.Dispose();
}
}