Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopperDEL <github_com@tparth.de>2020-05-15 13:59:48 +0300
committerTopperDEL <github_com@tparth.de>2020-05-15 13:59:48 +0300
commit6cda666b10e0fa830aea78b89805e737f807a2e1 (patch)
tree251f568076bb9f4ae53173346fb6d0f2a2a2f7d8 /Duplicati/Server
parentdd2f2f971c8b01a22c788242207c76730bc31464 (diff)
parente6dc5347ffc3eeb7af9495c7f83b6a9f7925563c (diff)
Merge branch 'master' of https://github.com/duplicati/duplicati into Tardigrade
Diffstat (limited to 'Duplicati/Server')
-rw-r--r--Duplicati/Server/Scheduler.cs38
-rw-r--r--Duplicati/Server/WebServer/Server.cs5
2 files changed, 34 insertions, 9 deletions
diff --git a/Duplicati/Server/Scheduler.cs b/Duplicati/Server/Scheduler.cs
index 5ec0a28f1..c5704d1a6 100644
--- a/Duplicati/Server/Scheduler.cs
+++ b/Duplicati/Server/Scheduler.cs
@@ -81,6 +81,7 @@ namespace Duplicati.Server
m_thread = new Thread(new ThreadStart(Runner));
m_worker = worker;
m_worker.CompletedWork += OnCompleted;
+ m_worker.StartingWork += OnStartingWork;
m_schedule = new KeyValuePair<DateTime, ISchedule>[0];
m_terminate = false;
m_event = new AutoResetEvent(false);
@@ -174,7 +175,7 @@ namespace Duplicati.Server
i = 50000;
while (!IsDateAllowed(res, allowedDays) && i-- > 0)
res = Timeparser.ParseTimeInterval(repetition, res);
- }
+ }
}
if (!IsDateAllowed(res, allowedDays) || res < firstdate)
@@ -211,7 +212,25 @@ namespace Duplicati.Server
}
}
-
+
+ private void OnStartingWork(WorkerThread<Runner.IRunnerData> worker, Runner.IRunnerData task)
+ {
+ if (task is null)
+ {
+ return;
+ }
+
+ lock(m_lock)
+ {
+ if (m_updateTasks.TryGetValue(task, out Tuple<ISchedule, DateTime, DateTime> scheduleInfo))
+ {
+ // Item2 is the scheduled start time (Time in the Schedule table).
+ // Item3 is the actual start time (LastRun in the Schedule table).
+ m_updateTasks[task] = Tuple.Create(scheduleInfo.Item1, scheduleInfo.Item2, DateTime.UtcNow);
+ }
+ }
+ }
+
/// <summary>
/// The actual scheduling procedure
/// </summary>
@@ -273,8 +292,8 @@ namespace Duplicati.Server
select n.Backup;
var tastTemp = m_worker.CurrentTask;
if (tastTemp != null && tastTemp.Operation == Duplicati.Server.Serialization.DuplicatiOperation.Backup)
- tmplst.Union(new [] { tastTemp.Backup });
-
+ tmplst = tmplst.Union(new [] { tastTemp.Backup });
+
//If it is not already in queue, put it there
if (!tmplst.Any(x => x.ID == id))
{
@@ -308,10 +327,15 @@ namespace Duplicati.Server
Server.Runner.IRunnerData lastJob = jobsToRun.LastOrDefault();
if (lastJob != null)
- lock(m_lock)
+ {
+ lock (m_lock)
+ {
+ // The actual last run time will be updated when the StartingWork event is raised.
m_updateTasks[lastJob] = new Tuple<ISchedule, DateTime, DateTime>(sc, start, DateTime.UtcNow);
-
- foreach(var job in jobsToRun)
+ }
+ }
+
+ foreach (var job in jobsToRun)
m_worker.AddTask(job);
if (start < DateTime.UtcNow)
diff --git a/Duplicati/Server/WebServer/Server.cs b/Duplicati/Server/WebServer/Server.cs
index 942d7536e..0ab45ba54 100644
--- a/Duplicati/Server/WebServer/Server.cs
+++ b/Duplicati/Server/WebServer/Server.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Linq;
using HttpServer.HttpModules;
@@ -398,11 +399,11 @@ namespace Duplicati.Server.WebServer
}
// Check the hostnames we always allow
- if (Array.IndexOf(DEFAULT_ALLOWED, host) >= 0)
+ if (DEFAULT_ALLOWED.Contains(host, StringComparer.OrdinalIgnoreCase))
return false;
// Then the user specified ones
- if (h != null && Array.IndexOf(h, host) >= 0)
+ if (h != null && h.Contains(host, StringComparer.OrdinalIgnoreCase))
return false;
// Disable checks if we have an asterisk