diff --git a/Duplicati/Library/RestAPI/Scheduler.cs b/Duplicati/Library/RestAPI/Scheduler.cs index 459cc14e4..521849416 100644 --- a/Duplicati/Library/RestAPI/Scheduler.cs +++ b/Duplicati/Library/RestAPI/Scheduler.cs @@ -100,7 +100,6 @@ namespace Duplicati.Server m_updateTasks = new Dictionary>(); m_thread.IsBackground = true; m_thread.Name = "TaskScheduler"; - m_thread.Start(); } public IList> GetProposedSchedule() @@ -121,6 +120,8 @@ namespace Duplicati.Server /// public void Reschedule() { + if (!m_thread.IsAlive && !m_terminate) + m_thread.Start(); m_event.Set(); } diff --git a/Duplicati/Server/Program.cs b/Duplicati/Server/Program.cs index d902ed241..1fdd3df75 100644 --- a/Duplicati/Server/Program.cs +++ b/Duplicati/Server/Program.cs @@ -257,6 +257,14 @@ namespace Duplicati.Server LiveControl.StateChanged = (e) => { LiveControl_StateChanged(queueRunner, connection, eventPollNotify, scheduler, e); }; + // Invoke it once to set initial state + LiveControl_StateChanged(queueRunner, connection, eventPollNotify, scheduler, new LiveControls.LiveControlEvent + { + State = LiveControl.State, + TransfersPaused = LiveControl.TransfersPaused, + WaitTimeExpiration = LiveControl.EstimatedPauseEnd + }); + if (Library.Utility.Utility.ParseBoolOption(commandlineOptions, PING_PONG_KEEPALIVE_OPTION)) { PingPongThread = new Thread(() => PingPongMethod(applicationSettings)) { IsBackground = true };