fix: enforce community cooldown per site

This commit is contained in:
ik
2026-09-08 16:32:42 +07:00
parent 731eade7b3
commit 486b4e9645
8 changed files with 72 additions and 12 deletions
+6
View File
@@ -12,6 +12,7 @@ from .community_importer import stage_observations
from .retention import RetentionPolicy, apply_retention
from .storage import delete_screenshot
from .catalog_audit import audit_catalog
from .community_scheduler import configured_sources, run_source
def main() -> int:
@@ -24,6 +25,8 @@ def main() -> int:
community = sub.add_parser("stage-community-json")
community.add_argument("--input", default="-", help="JSON array path or - for stdin")
community.add_argument("--limit", type=int, default=500)
fetch_community = sub.add_parser("fetch-community")
fetch_community.add_argument("source", choices=configured_sources())
cleanup = sub.add_parser("cleanup-retention")
cleanup.add_argument("--apply", action="store_true", help="apply changes; default is dry-run")
sub.add_parser("audit-catalog")
@@ -45,6 +48,9 @@ def main() -> int:
parser.error("input must be a JSON array")
created, updated = stage_observations(session, payload[:args.limit])
print(f"staged: created={created} updated={updated}")
elif args.command == "fetch-community":
started = run_source(args.source)
print("community fetch started" if started else "community fetch skipped: disabled, locked, or cooling down")
elif args.command == "cleanup-retention":
policy = RetentionPolicy(
submission_days=settings.retention_submission_days,