Files
shinkan-jinkendo/backend/scripts/media_retention_job.py
T
LarsandCursor 95d365d9fa
Deploy Development / deploy (push) Successful in 1m1s
Test Suite / pytest-backend (push) Failing after 49s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 19s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m57s
Schedule media retention at 03:00 Europe/Berlin.
The folded python -c command crashed the cron container before any run. Content-report rate limiting now applies only after the good-faith declaration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-28 11:14:37 +01:00

36 lines
940 B
Python

#!/usr/bin/env python3
"""
Automatische Medien-Retention (Papierkorb Stufe 1→2, Purge wenn fällig).
Einzellauf (der tägliche Planer ist media_retention_scheduler.py):
cd /path/to/backend && python scripts/media_retention_job.py
Umgebung wie Backend (DB_*), optional:
MEDIA_TRASH_SOFT_TO_HIDDEN_DAYS (Default 30)
MEDIA_TRASH_HIDDEN_TO_PURGE_DAYS (Default 30)
"""
from __future__ import annotations
import os
import sys
# Repo-Root: backend/scripts -> parents[1] == backend
_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if _ROOT not in sys.path:
sys.path.insert(0, _ROOT)
from db import get_db, get_cursor # noqa: E402
from media_lifecycle import run_retention_pass # noqa: E402
def main() -> int:
with get_db() as conn:
cur = get_cursor(conn)
summary = run_retention_pass(cur, conn)
print(summary)
return 0
if __name__ == "__main__":
raise SystemExit(main())