diff --git a/.last-branch b/.last-branch index e44715d..8cbfdcb 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260108-37-synology-updates-info-parser +v20260108-38-missed-run-grace-window diff --git a/containers/backupchecks/src/backend/app/main/routes_run_checks.py b/containers/backupchecks/src/backend/app/main/routes_run_checks.py index 52f023e..79e75c0 100644 --- a/containers/backupchecks/src/backend/app/main/routes_run_checks.py +++ b/containers/backupchecks/src/backend/app/main/routes_run_checks.py @@ -113,6 +113,8 @@ def _ensure_missed_runs_for_job(job: Job, start_from: date, end_inclusive: date) now_local_dt = datetime.now(tz) if tz else datetime.utcnow() + + now_utc_naive = _utc_naive_from_local(now_local_dt) # Remove any previously generated missed runs in this date window. # Missed runs must be based on learned schedule from real mail-reported runs. try: @@ -164,6 +166,15 @@ def _ensure_missed_runs_for_job(job: Job, start_from: date, end_inclusive: date) slot_utc_naive = _utc_naive_from_local(local_dt) + + + # Do not mark as missed until the full grace window has passed. + + + if now_utc_naive <= (slot_utc_naive + MISSED_GRACE_WINDOW): + + + continue # Consider any real run near the slot as fulfilling the schedule. # Also avoid duplicates if a missed run already exists. window_start = slot_utc_naive - MISSED_GRACE_WINDOW @@ -238,6 +249,15 @@ def _ensure_missed_runs_for_job(job: Job, start_from: date, end_inclusive: date) slot_utc_naive = _utc_naive_from_local(local_dt) + + + # Do not mark as missed until the full grace window has passed. + + + if now_utc_naive <= (slot_utc_naive + MISSED_GRACE_WINDOW): + + + continue window_start = slot_utc_naive - MISSED_GRACE_WINDOW window_end = slot_utc_naive + MISSED_GRACE_WINDOW diff --git a/docs/changelog.md b/docs/changelog.md index f797e69..cc354df 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -96,6 +96,14 @@ - Set overall status to Warning without creating schedules or expected-run logic. - Excluded Synology Updates informational messages from reporting output. +--- + +## v20260108-38-missed-run-grace-window + +- Adjusted missed run detection to respect a ±1 hour grace window around the scheduled run time. +- Prevented runs that arrive shortly after the scheduled time (e.g. a few minutes late) from being temporarily marked as Missed. +- Ensured Missed status is only applied after the full grace window has elapsed, avoiding false Missed entries in Run Checks and Daily Jobs. + ================================================================================================================================================ ## v0.1.18