Update to 3.5.2 and .net core 2.1

This commit is contained in:
stefan
2018-09-12 19:26:21 +02:00
parent c32d865638
commit 48facb797e
1419 changed files with 27525 additions and 88927 deletions

View File

@@ -160,7 +160,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
_lastExecutionResult = value;
var path = GetHistoryFilePath();
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
lock (_lastExecutionResultSyncLock)
{
@@ -236,7 +236,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <summary>
/// The _triggers
/// </summary>
private Tuple<TaskTriggerInfo,ITaskTrigger>[] _triggers;
private Tuple<TaskTriggerInfo, ITaskTrigger>[] _triggers;
/// <summary>
/// Gets the triggers that define when the task will run
/// </summary>
@@ -350,7 +350,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
async void trigger_Triggered(object sender, GenericEventArgs<TaskExecutionOptions> e)
async void trigger_Triggered(object sender, EventArgs e)
{
var trigger = (ITaskTrigger)sender;
@@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
trigger.Stop();
TaskManager.QueueScheduledTask(ScheduledTask, e.Argument);
TaskManager.QueueScheduledTask(ScheduledTask, trigger.TaskOptions);
await Task.Delay(1000).ConfigureAwait(false);
@@ -380,7 +380,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <param name="options">Task options.</param>
/// <returns>Task.</returns>
/// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>
public async Task Execute(TaskExecutionOptions options)
public async Task Execute(TaskOptions options)
{
var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false));
@@ -397,7 +397,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
}
private async Task ExecuteInternal(TaskExecutionOptions options)
private async Task ExecuteInternal(TaskOptions options)
{
// Cancel the current execution, if any
if (CurrentCancellationTokenSource != null)
@@ -422,14 +422,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
try
{
if (options != null && options.MaxRuntimeMs.HasValue)
if (options != null && options.MaxRuntimeTicks.HasValue)
{
CurrentCancellationTokenSource.CancelAfter(options.MaxRuntimeMs.Value);
CurrentCancellationTokenSource.CancelAfter(TimeSpan.FromTicks(options.MaxRuntimeTicks.Value));
}
var localTask = ScheduledTask.Execute(CurrentCancellationTokenSource.Token, progress);
await localTask.ConfigureAwait(false);
await ScheduledTask.Execute(CurrentCancellationTokenSource.Token, progress).ConfigureAwait(false);
status = TaskCompletionStatus.Completed;
}
@@ -563,13 +561,35 @@ namespace Emby.Server.Implementations.ScheduledTasks
catch (FileNotFoundException)
{
// File doesn't exist. No biggie. Return defaults.
return ScheduledTask.GetDefaultTriggers().ToArray();
}
catch (DirectoryNotFoundException)
{
// File doesn't exist. No biggie. Return defaults.
}
return ScheduledTask.GetDefaultTriggers().ToArray();
catch
{
}
return GetDefaultTriggers();
}
private TaskTriggerInfo[] GetDefaultTriggers()
{
try
{
return ScheduledTask.GetDefaultTriggers().ToArray();
}
catch
{
return new TaskTriggerInfo[]
{
new TaskTriggerInfo
{
IntervalTicks = TimeSpan.FromDays(1).Ticks,
Type = TaskTriggerInfo.TriggerInterval
}
};
}
}
/// <summary>
@@ -580,7 +600,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
var path = GetConfigurationFilePath();
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
JsonSerializer.SerializeToFile(triggers, path);
}
@@ -625,7 +645,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
@@ -705,9 +724,9 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
private ITaskTrigger GetTrigger(TaskTriggerInfo info)
{
var options = new TaskExecutionOptions
var options = new TaskOptions
{
MaxRuntimeMs = info.MaxRuntimeMs
MaxRuntimeTicks = info.MaxRuntimeTicks
};
if (info.Type.Equals(typeof(DailyTrigger).Name, StringComparison.OrdinalIgnoreCase))