fix(catchup): guard on real in-flight backup check; add scheduler tests

This commit is contained in:
2026-06-15 21:45:01 +01:00
parent 10b2518323
commit 9371b7b777
4 changed files with 275 additions and 2 deletions
+10 -2
View File
@@ -89,8 +89,16 @@ func (s *Server) runCatchup(ctx context.Context, hostID string, now time.Time) {
if host.AlwaysOn {
return // mode flipped during settle window
}
if host.CurrentJobID != nil {
return // a job is already running; don't pile on
// Skip if a backup is already queued or running for this host —
// don't pile a catch-up on top of in-flight work. (hosts.current_job_id
// is not maintained, so we check the jobs table directly.)
active, err := s.deps.Store.HasActiveBackupJob(ctx, hostID)
if err != nil {
slog.Warn("catchup: check active backup", "host_id", hostID, "err", err)
return
}
if active {
return
}
schedules, err := s.deps.Store.ListSchedulesByHost(ctx, hostID)
if err != nil {