feat: owner review 2 phase 2: scheduled jobs and log settings (#10)
CI / Build and test (push) Successful in 7m0s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 13m28s
CI / PostgreSQL 16 integration (push) Successful in 5m52s
CI / PostgreSQL 17 integration (push) Successful in 4m50s
CI / Docker image (push) Successful in 1m4s
Release / Server image (push) Successful in 1m35s

- Jobs > Scheduled on the desktop and the admin panel. Every timer that queued work is now a visible system schedule: archive scan, upload clean-up, index backup, job-history and audit clean-ups, desktop housekeeping. New actions: verify, thumbnails, proxies, analysis, maintenance, backup, clean-ups, reports.
- The scheduler: migration 0007, in-house recurrence, compare-and-set claim, catch-up, scan at start.
- Log settings: levels, retention, size parts, total limit, daily or hourly rotation, audit retention, diagnostics share; the server writes Debug/Trace to its files again; logging never fails a job.

Upgrade: CHRONOS_LOG_LEVEL set in an existing container locks both levels; migration 0007 is one-way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #10.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-27 11:19:26 +01:00
1 parent 1f089888e8
commit af9eeaab9b
349 files changed
+28341 -1304

No files matched your search

+16 -9
View File
@@ -1,6 +1,7 @@
using Chronos.Core.Imaging.Decoders;
using Chronos.Data;
using Chronos.Data.Archiving;
using Chronos.Data.Housekeeping;
using Chronos.Data.Jobs;
using Chronos.Server.Configuration;
@@ -8,10 +9,11 @@ namespace Chronos.Server.Storage;
/// <summary>
/// The archive engine behind the server (BRIEF §7, §14.4): ingest of verified uploads, lookup of proxies and
/// thumbnails, its job handlers (scan, rebuild, verify, import, thumbnails, proxies, maintenance) and the periodic
/// incremental scan (<see cref="ArchivePolling"/>); a scan queues thumbnails and proxies of what it indexes, as an upload
/// does. Decoding is managed only (BRIEF §4.2). The daily backup of an SQLite index runs with it
/// (<see cref="DatabaseBackupService"/>).
/// thumbnails, and its job handlers (scan, rebuild, verify, import, thumbnails, proxies, maintenance, the duplicates and
/// orphans reports, index backups and clean-ups with the server's own steps, the <see cref="ICleanupStep"/>s in DI); a scan
/// queues thumbnails and proxies of what it indexes, as an upload does. Decoding is managed only (BRIEF §4.2). Recurring
/// work (the periodic scan, the nightly backup of an SQLite index, clean-ups) is queued by the server's system schedules
/// (<see cref="Jobs.ServerScheduleHost"/>, owner review 2, R10).
/// </summary>
public static class ArchiveModule
{
@@ -24,14 +26,19 @@ public static class ArchiveModule
{
var options = sp.GetRequiredService<ServerOptions>();
// Photos the running job processes at once: the settings' value as it is when each sequence starts (owner review 1).
return new ArchiveService(sp.GetRequiredService<ChronosDatabase>(),
new ArchiveServiceOptions { Decoder = DecoderFactory.CreateServer(), Owner = Owner, ImagesAfterScan = true, Parallelism = () => options.Parallelism });
return new ArchiveService(sp.GetRequiredService<ChronosDatabase>(), new ArchiveServiceOptions
{
Decoder = DecoderFactory.CreateServer(),
Owner = Owner,
ImagesAfterScan = true,
Parallelism = () => options.Parallelism,
CleanupSteps = [.. sp.GetServices<ICleanupStep>()],
// Next to the index in the data folder, where the daily backups always went.
BackupDirectory = Path.Combine(options.DataPath, DatabaseBackups.DirectoryName),
});
});
services.AddSingleton<IArchiveIngest>(sp => sp.GetRequiredService<ArchiveService>().Ingest);
services.AddSingleton<IJobHandlerProvider>(sp => sp.GetRequiredService<ArchiveService>());
services.AddSingleton<IFrameAssetLocator, ArchiveAssetLocator>();
services.AddHostedService<DatabaseBackupService>();
services.AddSingleton<ArchivePolling>();
services.AddHostedService(sp => sp.GetRequiredService<ArchivePolling>());
}
}