feat: purge content of posts past retention window in scheduler - #16
Conversation
|
Warning Review limit reached
Next review available in: 46 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Long-lived posts accumulate large scraped bodies over time. Since only recent posts are ever surfaced to users, the
posts.contentcolumn is now nulled out for every post whosecreated_atis older thansettings.content_retention_days(default 7 days). The purge runs on each scheduler loop iteration, so content stays bounded continuously without manual intervention.A raw
UPDATE posts SET content = NULL WHERE created_at < cutoff AND content IS NOT NULLis used on purpose: a Core/ORMupdate()would also writeupdated_at = now()via the model'sonupdatehook, but this retention job must touch only the content column.Type of Change
Affected Components
http_policy.py)Testing
pytest— all tests passruff check . && ruff format .— no lint errorspython scripts/verify_sources.py— all sources resolve (if sources were added or modified)Migration
N/A — no schema change; this is application-level cleanup driven by
created_at.Policy Checklist
If checked, confirm all of the following:
robots.txtcompliance is preserved — the policy layer is not bypassed or disabled.2.0seconds.REDDIT_INGESTION_ENABLED=falsestill collects Reddit via RSS and makes no OAuth calls.httpxoraiohttpcalls exist outside the policy layer.Explanation:
services/scheduler.pygains one call topurge_expired_post_content(); it performs no network activity and does not alter collection or rate-limit behavior. No changes tohttp_policy.py,reddit/client.py, orreddit/collector.py.AI Layer Changes
N/A — no prompt, schema, or provider logic changed.
Additional Notes
MAX_SLEEP_SECONDS) and 60 s while emails are pending. Idempotent (content IS NOT NULLguard), so frequent re-runs are harmless.CONTENT_RETENTION_DAYS(default 7).