fix: logging never fails a job, one backup retention, first copy after the upgrade

Owner review 2, phase 2 review findings (scheduler core).

- Log.Write caught only IOException. Microsoft.Extensions.Logging wraps
  provider failures in an AggregateException, so a log line that could not
  be written (in tests: the process-wide sink of a stopped server whose log
  folder was gone) escaped JobEngine.RunAsync's catch before the failure was
  stored: the job stayed running and the worker faulted. This was the cause
  of the intermittent JobApiTests/ArchiveModuleTests failures. Log.Write now
  drops any non-fatal sink failure, TeeLogSink keeps a line from the other
  sinks, FileLogSink drops a line it cannot write and reopens the file at the
  next one, and LoggerSink drops what the providers throw. The scheduler's
  loop relies on the same guarantee.
- The daily backup loop (RunDailyAsync, IsDue, Interval, CheckInterval) had
  no caller since the index-backup schedule replaced it; it is removed and
  the DatabaseBackups summary describes the schedule.
- The first copy after the upgrade no longer waits a day (or for 03:00):
  SystemSchedule.LastDone seeds a new row due at once when its work was last
  done a period or more before, and both hosts pass the newest copy in the
  backups folder for index-backup.
- Back up now (Settings and Archive), the copy kept before a restore and a
  backup job that keeps fewer prune to the largest Copies kept of the backup
  schedules (DatabaseBackups.KeptAsync), not a fixed three. The four
  tooltips that promised three daily copies are reworded (en, it) and their
  stale translations deleted.
- New tests for the scheduler loop itself: a tick, Wake, a pass that threw,
  and dispose during a pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c5ad0c4c3f636129afe5dd1ce039185516da5621)
This commit is contained in:
Alby96 committed 2026-10-27 09:56:47 +01:00
1 parent 422f33d5f3
commit e384564784
59 files changed
+668 -264

No files matched your search

-4
View File
@@ -21,7 +21,6 @@
<data name="Tooltips.Archive.Availability.Offline" xml:space="preserve"><value>无法访问档案库文件夹;索引保留上次访问时的状态</value></data>
<data name="Tooltips.Archive.Availability.Online" xml:space="preserve"><value>档案库文件夹可访问且可写</value></data>
<data name="Tooltips.Archive.Availability.ReadOnly" xml:space="preserve"><value>可读但不可写:仅供浏览</value></data>
<data name="Tooltips.Archive.Backup" xml:space="preserve"><value>将索引数据库的一致性副本写入备份文件夹;保留最近三份</value></data>
<data name="Tooltips.Archive.Cameras" xml:space="preserve"><value>每台相机的照片数;照片最少的相机合并显示</value></data>
<data name="Tooltips.Archive.CancelSearch" xml:space="preserve"><value>停止搜索;未做任何更改</value></data>
<data name="Tooltips.Archive.ClearFilter" xml:space="preserve"><value>重新显示所选内容中的所有序列</value></data>
@@ -72,7 +71,6 @@
<data name="Tooltips.Archive.RebuildStart" xml:space="preserve"><value>将重建加入队列 · 期间档案库仍可使用</value></data>
<data name="Tooltips.Archive.Relink" xml:space="preserve"><value>选择已移动档案库的新文件夹;其中的序列会随之更新</value></data>
<data name="Tooltips.Archive.RenameApply" xml:space="preserve"><value>完全按列出的更改修改文件夹、附属文件和索引 · 崩溃后可继续</value></data>
<data name="Tooltips.Archive.Restore" xml:space="preserve"><value>在“设置 › 高级”中选择索引的每日备份;它会在下次启动时替换索引</value></data>
<data name="Tooltips.Archive.RetagApply" xml:space="preserve"><value>在附属文件和索引中更改这些序列的标签</value></data>
<data name="Tooltips.Archive.Retry" xml:space="preserve"><value>再次运行相同的操作</value></data>
<data name="Tooltips.Archive.Scan" xml:space="preserve"><value>增量扫描:按修改时间和大小查找新增、更改和删除的文件</value></data>
@@ -539,8 +537,6 @@
<data name="Tooltips.Settings.AnalysisWidth" xml:space="preserve"><value>深度分析时解码帧所用的最大长边(原始尺寸的一半,最多到此值);越宽越慢,但能看到更精细的细节</value></data>
<data name="Tooltips.Settings.ArchiveFree" xml:space="preserve"><value>档案库所在驱动器的可用空间</value></data>
<data name="Tooltips.Settings.ArchiveRoot" xml:space="preserve"><value>本地档案库的根文件夹;文件不会被移动 · Enter 应用,Esc 还原</value></data>
<data name="Tooltips.Settings.Backup" xml:space="preserve"><value>将索引复制到备份文件夹;保留最新的三份 · 需要几秒钟</value></data>
<data name="Tooltips.Settings.Backups" xml:space="preserve"><value>索引的每日副本(保留最新的三份);选择要恢复到的副本</value></data>
<data name="Tooltips.Settings.BrowseArchive" xml:space="preserve"><value>选择档案库文件夹</value></data>
<data name="Tooltips.Settings.BrowseCache" xml:space="preserve"><value>选择缓存文件夹;使用快速的 SSD 效果更好</value></data>
<data name="Tooltips.Settings.CacheFolder" xml:space="preserve"><value>帧溢出和缩略图的存放位置;使用快速的 SSD 效果更好 · Enter 应用,Esc 还原</value></data>