R-1288: a restore of a set-aside unit sets the replaced install's unit aside at once, with no alarm. R-1282: the later media restart time is stored and resumed at start, once. Red-proved. Commit only.
gates / gates (push) Successful in 1m26s

This commit is contained in:
2026-10-25 21:37:55 +01:00
parent a79a292d72
commit b5863a96eb
8 changed files with 274 additions and 13 deletions
+27
View File
@@ -83,6 +83,10 @@ type Settings struct {
// measured upload line (the last 14 off-site pushes) and qBittorrent's default-limit record (who owns the limit).
// Opaque on purpose — this package does not know the watch's types, and the watch does not reach into settings.
Upwatch json.RawMessage `json:"upwatch,omitempty"`
// MediaRestartLaterAt is the household's „later" media restart (RFC3339 UTC; empty = none) — stored so a controller
// restart before 03:30 does not forget it (R-1282).
MediaRestartLaterAt string `json:"media_restart_later_at,omitempty"`
// UnhealthyStopEventSeeded (v0.269.0) guards the ONE-TIME add of app_stopped_unhealthy (the
// seedAppUpdateEvents shape).
UnhealthyStopEventSeeded bool `json:"unhealthy_stop_event_seeded,omitempty"`
@@ -2929,6 +2933,29 @@ func (s *Settings) MarkMediaRestarted() error {
return s.save()
}
// GetMediaRestartLater returns the stored „later" media restart time (zero = none or unreadable).
func (s *Settings) GetMediaRestartLater() time.Time {
s.mu.RLock()
defer s.mu.RUnlock()
t, err := time.Parse(time.RFC3339, s.MediaRestartLaterAt)
if err != nil {
return time.Time{}
}
return t
}
// SetMediaRestartLater stores (or, with a zero time, clears) the „later" media restart time and saves.
func (s *Settings) SetMediaRestartLater(at time.Time) error {
s.mu.Lock()
defer s.mu.Unlock()
if at.IsZero() {
s.MediaRestartLaterAt = ""
} else {
s.MediaRestartLaterAt = at.UTC().Format(time.RFC3339)
}
return s.save()
}
// MediaRestartPending reports whether a drive changed after the media apps last restarted.
func (sp StoragePath) MediaRestartPending() bool {
return sp.MediaChangedAt != "" && sp.MediaRestartedAt < sp.MediaChangedAt