Merge pull request #1938 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-07-12 13:21:27 -04:00 committed by GitHub
commit b188b7ef06
2 changed files with 14 additions and 3 deletions

View File

@ -237,9 +237,12 @@ namespace MediaBrowser.Api
{ {
lock (_activeTranscodingJobs) lock (_activeTranscodingJobs)
{ {
var job = _activeTranscodingJobs.First(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase)); var job = _activeTranscodingJobs.FirstOrDefault(j => j.Type == type && string.Equals(j.Path, path, StringComparison.OrdinalIgnoreCase));
_activeTranscodingJobs.Remove(job); if (job != null)
{
_activeTranscodingJobs.Remove(job);
}
} }
if (!string.IsNullOrWhiteSpace(state.Request.DeviceId)) if (!string.IsNullOrWhiteSpace(state.Request.DeviceId))

View File

@ -60,7 +60,15 @@ namespace MediaBrowser.Common.ScheduledTasks
triggerDate = DateTime.UtcNow.AddMinutes(1); triggerDate = DateTime.UtcNow.AddMinutes(1);
} }
Timer = new Timer(state => OnTriggered(), null, triggerDate - DateTime.UtcNow, TimeSpan.FromMilliseconds(-1)); var dueTime = triggerDate - DateTime.UtcNow;
var maxDueTime = TimeSpan.FromDays(7);
if (dueTime > maxDueTime)
{
dueTime = maxDueTime;
}
Timer = new Timer(state => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));
} }
/// <summary> /// <summary>