mirror of
https://github.com/duplicati/duplicati.git
synced 2026-05-10 09:09:39 -04:00
9f79025744
Re-implemented everything using ASP.NET. Changed some requests to use JSON instead of FORM data. Some work towards deleting the FIXMEGlobal instance. Auth is missing, XSRF does not work correctly.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
#nullable enable
|
|
using Duplicati.Library.IO;
|
|
using Duplicati.Library.RestAPI;
|
|
using Duplicati.Library.RestAPI.Abstractions;
|
|
using Duplicati.Library.Utility;
|
|
using Duplicati.Server;
|
|
using Duplicati.WebserverCore.Abstractions;
|
|
|
|
namespace Duplicati.WebserverCore.Services;
|
|
|
|
public class WorkerThreadsManager(ILiveControls liveControls, IScheduler scheduler) : IWorkerThreadsManager
|
|
{
|
|
public WorkerThread<Runner.IRunnerData>? WorkerThread { get; private set; }
|
|
|
|
public void Spawn(Action<Runner.IRunnerData> item)
|
|
{
|
|
WorkerThread = new WorkerThread<Runner.IRunnerData>(item, liveControls.IsPaused);
|
|
scheduler.Init(WorkerThread);
|
|
}
|
|
|
|
public Tuple<long, string>? CurrentTask
|
|
{
|
|
get
|
|
{
|
|
var t = WorkerThread?.CurrentTask;
|
|
return t == null ? null : new Tuple<long, string>(t.TaskID, t.Backup.ID);
|
|
}
|
|
}
|
|
|
|
public void UpdateThrottleSpeeds()
|
|
{
|
|
WorkerThread?.CurrentTask?.UpdateThrottleSpeed();
|
|
}
|
|
|
|
public long AddTask(Runner.IRunnerData data, bool skipQueue = false)
|
|
{
|
|
WorkerThread!.AddTask(data, skipQueue);
|
|
FIXMEGlobal.StatusEventNotifyer.SignalNewEvent();
|
|
return data.TaskID;
|
|
}
|
|
} |