diff --git a/lambda/backup-verification/app.py b/lambda/backup-verification/app.py index 4935e03..77c886d 100644 --- a/lambda/backup-verification/app.py +++ b/lambda/backup-verification/app.py @@ -69,11 +69,13 @@ def _check_gcs(): blobs.extend(list(bucket.list_blobs(prefix=f"archive/{date_prefix}/"))) if not blobs: return False, "GCS Offsite: No objects found under archive/ for last 2 days" - cutoff = now - timedelta(hours=72) + cutoff = now - timedelta(hours=48) latest = max(blobs, key=lambda b: b.updated) if latest.updated < cutoff: age = (now - latest.updated).total_seconds() / 3600 return False, f"GCS Offsite: Latest object is {age:.0f}h old ({latest.name})" + if latest.size < 1_000_000: + return False, f"GCS Offsite: Latest dump suspiciously small ({latest.size} bytes)" return True, f"GCS Offsite: OK — {latest.name} ({latest.size / 1_000_000:.1f} MB)" except Exception as e: return False, f"GCS Offsite: Error — {e}"