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
@@ -16,7 +16,7 @@ public sealed record LockedAge(string Setting, string Variable, int Days);
|
||||
/// What the server tells its <see cref="Scheduler"/> (owner review 2, R10): the container's time zone (TZ), the archive it
|
||||
/// serves with the settings another writer put into archive.json (refreshed at every run, as the former polling did), the
|
||||
/// server's own clean-up steps, and its system schedules, which stand for every timer it ran out of sight before: the
|
||||
/// archive scan every 10 minutes (no catch-up), the uploads sweep every 30 minutes, the nightly copy of an SQLite index,
|
||||
/// archive scan every 10 minutes (no catch-up), the uploads sweep every 6 hours, the nightly copy of an SQLite index,
|
||||
/// the job history and the audit log retentions. They are seeded from <see cref="ServerOptions"/> once (the user's edits
|
||||
/// stay) and reset to the options as they are then.
|
||||
/// </summary>
|
||||
@@ -31,8 +31,11 @@ public sealed class ServerScheduleHost : IScheduleHost
|
||||
/// <summary>Minutes between two archive scans (the desktop's rhythm, as the polling had).</summary>
|
||||
public const int ScanMinutes = 10;
|
||||
|
||||
/// <summary>Minutes between two sweeps of abandoned uploads (as the upload maintenance had).</summary>
|
||||
public const int UploadSweepMinutes = 30;
|
||||
/// <summary>
|
||||
/// Hours between two sweeps of abandoned uploads: rare enough to keep the job history readable (four clean-up jobs a
|
||||
/// day); an idle upload still expires after <see cref="ServerOptions.UploadRetentionHours"/>, at most this much later.
|
||||
/// </summary>
|
||||
public const int UploadSweepHours = 6;
|
||||
|
||||
private readonly ChronosDatabase _db;
|
||||
private readonly ServerOptions _options;
|
||||
@@ -67,7 +70,7 @@ public sealed class ServerScheduleHost : IScheduleHost
|
||||
{
|
||||
// A missed scan is not caught up: the next one comes within minutes and SchedulerHost scans once at start.
|
||||
new(ArchiveScan, "Archive scan", ScheduleActions.Scan, ScheduleRecurrence.Interval(ScanMinutes, RecurrenceUnit.Minutes), CatchUp: false),
|
||||
new(UploadCleanup, "Upload clean-up", ScheduleActions.Cleanup, ScheduleRecurrence.Interval(UploadSweepMinutes, RecurrenceUnit.Minutes),
|
||||
new(UploadCleanup, "Upload clean-up", ScheduleActions.Cleanup, ScheduleRecurrence.Interval(UploadSweepHours, RecurrenceUnit.Hours),
|
||||
new ScheduleParametersDto(OlderThanDays: UploadMaintenance.FinishedRetentionDays, Steps: [UploadCleanupStep.StepName])),
|
||||
};
|
||||
// PostgreSQL is backed up with its own tools (BRIEF §6.2): no schedule that could never run.
|
||||
@@ -107,6 +110,9 @@ public sealed class ServerScheduleHost : IScheduleHost
|
||||
/// <summary>The server runs every action it has a handler for; the scheduler finds the rest out itself.</summary>
|
||||
public string? Unavailable(string action) => null;
|
||||
|
||||
/// <summary>The server has no such setting: a scan schedule's own <c>deep</c> parameter decides, off when unset.</summary>
|
||||
public bool DeepAnalysisAfterScan => false;
|
||||
|
||||
/// <summary>
|
||||
/// The age limit of the system schedule <paramref name="systemKey"/> that an environment variable fixes
|
||||
/// (<c>CHRONOS_AUDIT_RETENTION_DAYS</c> for <see cref="AuditCleanup"/>); null when the schedule's own value applies.
|
||||
|
||||
Reference in new issue
Block a user