Merge pull request #733 from Bond-009/startuptasks
Remove unused function
This commit is contained in:
commit
ea851317e7
|
@ -10,7 +10,6 @@ using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Model.Events;
|
using MediaBrowser.Model.Events;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Model.Events;
|
using MediaBrowser.Model.Events;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
@ -74,38 +72,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
ScheduledTasks = new IScheduledTaskWorker[] { };
|
ScheduledTasks = new IScheduledTaskWorker[] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunStartupTasks()
|
|
||||||
{
|
|
||||||
var path = Path.Combine(ApplicationPaths.CachePath, "startuptasks.txt");
|
|
||||||
|
|
||||||
// ToDo: Fix this shit
|
|
||||||
if (!File.Exists(path))
|
|
||||||
return;
|
|
||||||
|
|
||||||
List<string> lines;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
lines = File.ReadAllLines(path).Where(i => !string.IsNullOrWhiteSpace(i)).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
|
||||||
|
|
||||||
foreach (var key in lines)
|
|
||||||
{
|
|
||||||
var task = ScheduledTasks.FirstOrDefault(i => string.Equals(i.ScheduledTask.Key, key, StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
if (task != null)
|
|
||||||
{
|
|
||||||
QueueScheduledTask(task, new TaskOptions());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_fileSystem.DeleteFile(path);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cancels if running and queue.
|
/// Cancels if running and queue.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -247,14 +213,9 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
/// <param name="tasks">The tasks.</param>
|
/// <param name="tasks">The tasks.</param>
|
||||||
public void AddTasks(IEnumerable<IScheduledTask> tasks)
|
public void AddTasks(IEnumerable<IScheduledTask> tasks)
|
||||||
{
|
{
|
||||||
var myTasks = ScheduledTasks.ToList();
|
var list = tasks.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem));
|
||||||
|
|
||||||
var list = tasks.ToList();
|
ScheduledTasks = ScheduledTasks.Concat(list).ToArray();
|
||||||
myTasks.AddRange(list.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem)));
|
|
||||||
|
|
||||||
ScheduledTasks = myTasks.ToArray();
|
|
||||||
|
|
||||||
RunStartupTasks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user