fix: one audit retention, scans at start, live deep analysis and a 6-hour upload sweep
Settle what the R10 scheduler and R11 log packages left open when they were integrated (owner review 2, phase 2). - Audit retention has one source of truth, the audit-cleanup schedule's age limit. AuditRetentionDays defaults to 0 (the audit log is kept forever, so an upgrade deletes nothing; the schedule is seeded off) and accepts 0-3650, what a schedule's age limit takes. Saving Settings › Logs › Keep audit sets the schedule's limit (on with a limit, off at 0) without a restart; CHRONOS_AUDIT_RETENTION_DAYS locks it and Reset goes back to it. - Both hosts scan right after start again, as their polling did: the server after the scheduler starts, the desktop once the archive was reopened and again when an unplugged one is back. Scheduler.RunSystemNowAsync runs the archive-scan schedule when it is enabled and has not run since the start, and skips while its scan is pending. - Desktop scans follow Settings › Analysis › After a scan at every run: a scan schedule without its own deep parameter asks the host (IScheduleHost.DeepAnalysisAfterScan), the archive-scan schedule no longer freezes the setting, and the editor offers deep only for analyses, so the setting's tooltip stays true. - The server's upload clean-up runs every 6 hours instead of every 30 minutes, to keep the job history readable; idle uploads still expire after UploadRetentionHours. - The Unraid template and docker-compose leave CHRONOS_LOG_LEVEL empty or commented out, and say that setting it locks both log levels, so the admin panel can change them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc786c12c4
commit
8d66be709c
21 files changed
+299
-53
No files matched your search
@@ -29,6 +29,12 @@ public interface IScheduleHost
|
||||
/// <summary>The names of the clean-up steps this host's <see cref="JobKind.Cleanup"/> jobs run (normally those of <c>ArchiveService.CleanupSteps</c>).</summary>
|
||||
IReadOnlyList<string> CleanupSteps { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether a scan whose schedule leaves its <c>deep</c> parameter unset gives the sequences it finds a deep analysis.
|
||||
/// Read at every run, so the desktop's scans follow Settings › Analysis › After a scan as it is then; false on the server.
|
||||
/// </summary>
|
||||
bool DeepAnalysisAfterScan { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Why this host does not run <paramref name="action"/> (a short code, e.g. <c>not-here</c>), or null when it may. Asked
|
||||
/// before the scheduler's own checks (<see cref="ScheduleUnavailable"/>), for the action list and at every run.
|
||||
|
||||
@@ -36,7 +36,10 @@ public sealed record ScheduleActionContext(ChronosDatabase Database, IScheduleHo
|
||||
/// </summary>
|
||||
public static class ScheduleActions
|
||||
{
|
||||
/// <summary>Incremental scan of the archive (<c>force</c>: a full one; <c>deep</c>: deep analysis of what it indexes).</summary>
|
||||
/// <summary>
|
||||
/// Incremental scan of the archive (<c>force</c>: a full one; <c>deep</c>: deep analysis of what it indexes; unset, as the
|
||||
/// host says at the run, <see cref="IScheduleHost.DeepAnalysisAfterScan"/>).
|
||||
/// </summary>
|
||||
public const string Scan = "scan";
|
||||
|
||||
/// <summary>Integrity check of the originals, the least recently verified first (<c>olderThanDays</c>, <c>percent</c>).</summary>
|
||||
@@ -96,7 +99,8 @@ public static class ScheduleActions
|
||||
/// <summary>The parameters a new schedule of <paramref name="action"/> starts with.</summary>
|
||||
public static ScheduleParametersDto Defaults(string action) => action switch
|
||||
{
|
||||
Scan => new(Force: false, Deep: false),
|
||||
// No deep: a scan follows the host's choice at run time (IScheduleHost.DeepAnalysisAfterScan) unless its schedule sets one.
|
||||
Scan => new(Force: false),
|
||||
Verify => new(OlderThanDays: 30, Percent: 100),
|
||||
Thumbnails or Proxies => new(Force: false),
|
||||
Analysis => new(Deep: false),
|
||||
@@ -116,7 +120,7 @@ public static class ScheduleActions
|
||||
var d = Defaults(action);
|
||||
return action switch
|
||||
{
|
||||
Scan => new(Force: p.Force ?? d.Force, Deep: p.Deep ?? d.Deep),
|
||||
Scan => new(Force: p.Force ?? d.Force, Deep: p.Deep),
|
||||
Verify => new(OlderThanDays: p.OlderThanDays ?? d.OlderThanDays, Percent: p.Percent ?? d.Percent),
|
||||
Thumbnails or Proxies => new(Force: p.Force ?? d.Force),
|
||||
Analysis => new(Deep: p.Deep ?? d.Deep),
|
||||
@@ -189,7 +193,7 @@ public static class ScheduleActions
|
||||
{
|
||||
case Scan:
|
||||
return await PendingAsync(db, [JobKind.Scan, JobKind.Rebuild], archive, cancellationToken).ConfigureAwait(false)
|
||||
?? ScheduleResolution.Queue([ArchiveJobs.Scan(archive, full: p.Force == true, deepAnalysis: p.Deep == true)]);
|
||||
?? ScheduleResolution.Queue([ArchiveJobs.Scan(archive, full: p.Force == true, deepAnalysis: p.Deep ?? context.Host.DeepAnalysisAfterScan)]);
|
||||
case Verify:
|
||||
return await PendingAsync(db, [JobKind.Verify], archive, cancellationToken).ConfigureAwait(false)
|
||||
?? await VerifyAsync(context, archive, p, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -158,6 +158,19 @@ public sealed class Scheduler : IAsyncDisposable
|
||||
return new ScheduleRunDto(dto, fire.Outcome, fire.JobId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the system schedule <paramref name="systemKey"/> now (<see cref="RunNowAsync"/>, which skips while its work is
|
||||
/// pending) when it is enabled and has not run since <paramref name="since"/>; null when it did not run. The hosts' archive
|
||||
/// scan once at start, as their polling did, and on the desktop when its archive is opened again (owner review 2, R10).
|
||||
/// </summary>
|
||||
public async Task<ScheduleRunDto?> RunSystemNowAsync(string systemKey, DateTimeOffset? since = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_ = RequireHost();
|
||||
if (await _db.Schedules.GetBySystemKeyAsync(systemKey, cancellationToken).ConfigureAwait(false) is not { Enabled: true } schedule
|
||||
|| schedule.LastRun >= since) return null;
|
||||
return await RunNowAsync(schedule.Id, null, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>The schedules (system ones first), the actions with their availability here, the host's time zone and clean-up steps.</summary>
|
||||
public async Task<SchedulesDto> ListAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user