merge: or5 parcel p4
# Conflicts: # src/Chronos.App/Sections/ServerView.xaml # src/Chronos.App/Sections/ServerViewModel.cs # src/Chronos.Server/Jobs/JobEngineHost.cs
This commit is contained in:
commit
e367f03c80
127 files changed
+6822
-1117
No files matched your search
@@ -67,6 +67,8 @@ public sealed class DesktopScheduleHost(AppSettings settings, Func<ChronosDataba
|
||||
// The ages and the limit are Settings › Workspace's, read at each run: the schedule holds no days of its own.
|
||||
new(WorkspaceCleanup, "Workspace clean-up", ScheduleActions.Cleanup, ScheduleRecurrence.DailyAt(WorkspaceCleanupTime),
|
||||
new ScheduleParametersDto(Steps: [WorkspaceCleanStep.StepName, WorkspaceTrashStep.StepName], OlderThanDays: 0)),
|
||||
// While this PC shares its library (owner review 5, #67): the shared library's own clean-ups, which its Reset restores.
|
||||
.. settings.Share.Enabled ? Chronos.Server.Jobs.ServerScheduleHost.ShareSchedules(0) : [],
|
||||
];
|
||||
|
||||
public IReadOnlyList<string> CleanupSteps => archives()?.CleanupSteps.Select(s => s.Name).ToList() ?? [];
|
||||
@@ -84,7 +86,11 @@ public sealed class DesktopScheduleHost(AppSettings settings, Func<ChronosDataba
|
||||
public async ValueTask<Archive?> GetArchiveAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (database() is not { } db || archives() is not { } service) return null;
|
||||
var archive = CurrentArchive.Pick(await db.Archives.ListAsync(cancellationToken).ConfigureAwait(false), settings.LastArchivePath);
|
||||
var listed = await db.Archives.ListAsync(cancellationToken).ConfigureAwait(false);
|
||||
// Never a server's originals archive in place of this PC's (owner review 5): the app scans those after this one.
|
||||
var originals = settings.KnownServers.Select(k => k.OriginalsArchiveId).OfType<Guid>().ToHashSet();
|
||||
var archive = (settings.LastArchivePath is { Length: > 0 } last ? CurrentArchive.At(listed, last) : null)
|
||||
?? CurrentArchive.Pick([.. listed.Where(a => !originals.Contains(a.Id))], null) ?? CurrentArchive.Pick(listed, null);
|
||||
if (archive is null || ArchiveService.GetAvailability(archive) == ArchiveAvailability.Offline) return null;
|
||||
try
|
||||
{
|
||||
@@ -110,14 +116,15 @@ public sealed class DesktopScheduleHost(AppSettings settings, Func<ChronosDataba
|
||||
/// The desktop's clean-up step <c>cache-trim</c> (owner review 2, R10): brings the cache folder down to Settings › Storage ›
|
||||
/// Cache limit, oldest files first, skipping files in use (<see cref="CacheStore.Trim"/>). The proxies of server sequences
|
||||
/// (complete sets the sync keeps), the render node's folder (it trims its own downloads to the same limit) and the copies an
|
||||
/// import to the server stages are never trimmed; Settings › Storage › Clear still empties everything.
|
||||
/// import to the server stages are never trimmed, in the former shared folders and in each server's own (<c>servers</c>,
|
||||
/// owner review 5); Settings › Storage › Clear still empties everything.
|
||||
/// </summary>
|
||||
public sealed class CacheTrimStep(Func<string> folder, Func<long> limitBytes) : ICleanupStep
|
||||
{
|
||||
public const string StepName = "cache-trim";
|
||||
|
||||
/// <summary>Folders of the cache the trim leaves whole.</summary>
|
||||
public static IReadOnlyList<string> Kept { get; } = ["proxies", "render-node", "server-import"];
|
||||
public static IReadOnlyList<string> Kept { get; } = ["proxies", "render-node", "server-import", Chronos.Core.IO.HomeFolders.Servers];
|
||||
|
||||
public string Name => StepName;
|
||||
|
||||
|
||||
Reference in new issue
Block a user