Added Hangfire with LiteDB for a task running system. At the most basic, this allows us to monitor tasks running on the system (during dev only) and run tasks on a reoccuring or ad-hoc basis.

This commit is contained in:
Joseph Milazzo 2020-12-26 14:03:35 -06:00
parent e1c1719b6a
commit 4fd9943b91
22 changed files with 69 additions and 43 deletions

View file

@ -29,7 +29,7 @@ namespace API.Services
/// <returns>List of folder names</returns>
public IEnumerable<string> ListDirectory(string rootPath)
{
// TODO: Put some checks in here along with API to ensure that we aren't passed a file, folder exists, etc.
if (!Directory.Exists(rootPath)) return ImmutableList<string>.Empty;
var di = new DirectoryInfo(rootPath);
var dirs = di.GetDirectories()
@ -137,7 +137,7 @@ namespace API.Services
else {
Parallel.ForEach(files, () => 0, (file, loopState, localCount) =>
{ action(file);
return (int) ++localCount;
return ++localCount;
},
(c) => {
Interlocked.Add(ref fileCount, c);

View file

@ -0,0 +1,17 @@
using API.Interfaces;
using Hangfire;
namespace API.Services
{
public class TaskScheduler : ITaskScheduler
{
private readonly BackgroundJobServer _client;
public TaskScheduler()
{
_client = new BackgroundJobServer();
}
}
}