aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/EntryPoints
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-06-19 02:18:29 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-06-19 02:18:29 -0400
commit759f5a856064450acdb4c26839d6d890afb99a17 (patch)
treebc90bdc82a218644a1baa6762105afba6062b7ce /MediaBrowser.Server.Implementations/EntryPoints
parent244531f9923bec28f4b1f6d55ad6858bd90f2135 (diff)
update task results
Diffstat (limited to 'MediaBrowser.Server.Implementations/EntryPoints')
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs28
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs2
2 files changed, 18 insertions, 12 deletions
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
index f520316bcb..d5f265ddad 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
@@ -8,6 +8,7 @@ using MediaBrowser.Model.Tasks;
using System;
using System.Linq;
using System.Threading;
+using System.Threading.Tasks;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.LiveTv;
@@ -52,24 +53,29 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
}
}
- private void TimerCallback(object state)
+ private async void TimerCallback(object state)
{
- if (_config.Configuration.EnableAutomaticRestart && IsIdle())
+ if (_config.Configuration.EnableAutomaticRestart)
{
- DisposeTimer();
+ var isIdle = await IsIdle().ConfigureAwait(false);
- try
+ if (isIdle)
{
- _appHost.Restart();
- }
- catch (Exception ex)
- {
- _logger.ErrorException("Error restarting server", ex);
+ DisposeTimer();
+
+ try
+ {
+ _appHost.Restart();
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error restarting server", ex);
+ }
}
}
}
- private bool IsIdle()
+ private async Task<bool> IsIdle()
{
if (_iTaskManager.ScheduledTasks.Any(i => i.State != TaskState.Idle))
{
@@ -80,7 +86,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
{
try
{
- var timers = _liveTvManager.GetTimers(new TimerQuery(), CancellationToken.None).Result;
+ var timers = await _liveTvManager.GetTimers(new TimerQuery(), CancellationToken.None).ConfigureAwait(false);
if (timers.Items.Any(i => i.Status == RecordingStatus.InProgress))
{
return false;
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index b059e41440..b616b7761a 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -119,7 +119,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
.DistinctBy(i => i.Id)
.Select(i =>
{
- var dto = _userDataManager.GetUserDataDto(i, user);
+ var dto = _userDataManager.GetUserDataDto(i, user).Result;
dto.ItemId = i.Id.ToString("N");
return dto;
})