aboutsummaryrefslogtreecommitdiff
path: root/Emby.Notifications/Notifications.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Notifications/Notifications.cs')
-rw-r--r--Emby.Notifications/Notifications.cs13
1 files changed, 6 insertions, 7 deletions
diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs
index fbdc39f94..d3290479f 100644
--- a/Emby.Notifications/Notifications.cs
+++ b/Emby.Notifications/Notifications.cs
@@ -20,7 +20,6 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Notifications
@@ -40,9 +39,8 @@ namespace Emby.Notifications
private readonly ILibraryManager _libraryManager;
private readonly ISessionManager _sessionManager;
private readonly IServerApplicationHost _appHost;
- private readonly ITimerFactory _timerFactory;
- private ITimer LibraryUpdateTimer { get; set; }
+ private Timer LibraryUpdateTimer { get; set; }
private readonly object _libraryChangedSyncLock = new object();
private readonly IConfigurationManager _config;
@@ -52,7 +50,7 @@ namespace Emby.Notifications
private string[] _coreNotificationTypes;
- public Notifications(IInstallationManager installationManager, IActivityManager activityManager, ILocalizationManager localization, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost, IConfigurationManager config, IDeviceManager deviceManager, ITimerFactory timerFactory)
+ public Notifications(IInstallationManager installationManager, IActivityManager activityManager, ILocalizationManager localization, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost, IConfigurationManager config, IDeviceManager deviceManager)
{
_installationManager = installationManager;
_userManager = userManager;
@@ -64,19 +62,20 @@ namespace Emby.Notifications
_appHost = appHost;
_config = config;
_deviceManager = deviceManager;
- _timerFactory = timerFactory;
_localization = localization;
_activityManager = activityManager;
_coreNotificationTypes = new CoreNotificationTypes(localization, appHost).GetNotificationTypes().Select(i => i.Type).ToArray();
}
- public void Run()
+ public Task RunAsync()
{
_libraryManager.ItemAdded += _libraryManager_ItemAdded;
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
_appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged;
_activityManager.EntryCreated += _activityManager_EntryCreated;
+
+ return Task.CompletedTask;
}
private async void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
@@ -157,7 +156,7 @@ namespace Emby.Notifications
{
if (LibraryUpdateTimer == null)
{
- LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, 5000,
+ LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, 5000,
Timeout.Infinite);
}
else