aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-10-25 12:47:20 +0200
committerBond_009 <bond.009@outlook.com>2019-11-22 16:15:31 +0100
commitb477b3874ef8d79a1e27f8bb298d38443c3ec425 (patch)
tree9e2ce5032892e4c590cab63269081c413cbfdac7 /Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
parent7846e9cb3cce026b81509454c8128cc7ca17c2f8 (diff)
Fix some warnings
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/TaskManager.cs')
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/TaskManager.cs32
1 files changed, 16 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
index 595c3037d..ecf58dbc0 100644
--- a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
@@ -36,19 +36,19 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Gets or sets the json serializer.
/// </summary>
/// <value>The json serializer.</value>
- private IJsonSerializer JsonSerializer { get; set; }
+ private readonly IJsonSerializer _jsonSerializer;
/// <summary>
/// Gets or sets the application paths.
/// </summary>
/// <value>The application paths.</value>
- private IApplicationPaths ApplicationPaths { get; set; }
+ private readonly IApplicationPaths _applicationPaths;
/// <summary>
/// Gets the logger.
/// </summary>
/// <value>The logger.</value>
- private ILogger Logger { get; set; }
+ private readonly ILogger _logger;
private readonly IFileSystem _fileSystem;
/// <summary>
@@ -57,19 +57,19 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <param name="applicationPaths">The application paths.</param>
/// <param name="jsonSerializer">The json serializer.</param>
/// <param name="loggerFactory">The logger factory.</param>
- /// <exception cref="System.ArgumentException">kernel</exception>
+ /// <param name="fileSystem">The filesystem manager.</param>
public TaskManager(
IApplicationPaths applicationPaths,
IJsonSerializer jsonSerializer,
ILoggerFactory loggerFactory,
IFileSystem fileSystem)
{
- ApplicationPaths = applicationPaths;
- JsonSerializer = jsonSerializer;
- Logger = loggerFactory.CreateLogger(nameof(TaskManager));
+ _applicationPaths = applicationPaths;
+ _jsonSerializer = jsonSerializer;
+ _logger = loggerFactory.CreateLogger(nameof(TaskManager));
_fileSystem = fileSystem;
- ScheduledTasks = new IScheduledTaskWorker[] { };
+ ScheduledTasks = Array.Empty<IScheduledTaskWorker>();
}
/// <summary>
@@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <typeparam name="T"></typeparam>
/// <param name="options">Task options.</param>
public void CancelIfRunningAndQueue<T>(TaskOptions options)
- where T : IScheduledTask
+ where T : IScheduledTask
{
var task = ScheduledTasks.First(t => t.ScheduledTask.GetType() == typeof(T));
((ScheduledTaskWorker)task).CancelIfRunning();
@@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (scheduledTask == null)
{
- Logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
+ _logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
}
else
{
@@ -147,13 +147,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (scheduledTask == null)
{
- Logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
+ _logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
}
else
{
var type = scheduledTask.ScheduledTask.GetType();
- Logger.LogInformation("Queueing task {0}", type.Name);
+ _logger.LogInformation("Queueing task {0}", type.Name);
lock (_taskQueue)
{
@@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (scheduledTask == null)
{
- Logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
+ _logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
}
else
{
@@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
var type = task.ScheduledTask.GetType();
- Logger.LogInformation("Queueing task {0}", type.Name);
+ _logger.LogInformation("Queueing task {0}", type.Name);
lock (_taskQueue)
{
@@ -213,7 +213,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <param name="tasks">The tasks.</param>
public void AddTasks(IEnumerable<IScheduledTask> tasks)
{
- var list = tasks.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem));
+ var list = tasks.Select(t => new ScheduledTaskWorker(t, _applicationPaths, this, _jsonSerializer, _logger, _fileSystem));
ScheduledTasks = ScheduledTasks.Concat(list).ToArray();
}
@@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary>
private void ExecuteQueuedTasks()
{
- Logger.LogInformation("ExecuteQueuedTasks");
+ _logger.LogInformation("ExecuteQueuedTasks");
// Execute queued tasks
lock (_taskQueue)