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>