Skip to content

reddit: /r/ URLs refresh hourly; unblock the reddit crawl - #278

Merged
ralyodio merged 1 commit into
mainfrom
reddit-hourly-refresh
Nov 9, 2026
Merged

ralyodio merged 1 commit into
mainfrom
reddit-hourly-refresh

Conversation

@ralyodio

@ralyodio ralyodio commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

r/rss had not been read since 2026-10-23 and only ~7 of 50k subreddits
were read per hour. Two bugs plus a freshness rule:

  • One subreddit returning an empty listing (private/banned) was treated
    as a host-wide 429 and held back ~200 reddit feeds for 20 min, every
    few minutes. empty-result is now hostWide:false: that feed is
    throttled, the host queue keeps walking.
  • NUL bytes in reddit text failed the Postgres write ("invalid byte
    sequence for encoding UTF8: 0x00") on every crawl. Stripped at parse.
  • Any /r/, /r/u/ page or .rss/.json read of a copy older than
    an hour puts the row at the front of its tier (requestRefreshIfStale),
    so anything someone reads or polls is at most ~1h + one tick stale.

🤖 Generated with Claude Code

r/rss had not been read since 2026-10-23 and only ~7 of 50k subreddits
were read per hour. Two bugs plus a freshness rule:

- One subreddit returning an empty listing (private/banned) was treated
  as a host-wide 429 and held back ~200 reddit feeds for 20 min, every
  few minutes. empty-result is now hostWide:false: that feed is
  throttled, the host queue keeps walking.
- NUL bytes in reddit text failed the Postgres write ("invalid byte
  sequence for encoding UTF8: 0x00") on every crawl. Stripped at parse.
- Any /r/<sub>, /r/u/<user> page or .rss/.json read of a copy older than
  an hour puts the row at the front of its tier (requestRefreshIfStale),
  so anything someone reads or polls is at most ~1h + one tick stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit e81a7f7 into main Nov 9, 2026
3 checks passed
@ralyodio
ralyodio deleted the reddit-hourly-refresh branch November 9, 2026 19:32
sh1pt-actions-fleet Bot pushed a commit that referenced this pull request Nov 9, 2026
…hour

Arctic Shift answers 422 'Timeout. Maybe slow down a bit' after ~5 back-
to-back pages (measured), and pages are capped at 100 (~6 s of Reddit). So:
- pages 4 s apart, 12 per pass, a pass every 60 s (~11/min, just over
  Reddit's pace); env REDDIT_FIREHOSE_GAP_MS / _PAGES / _MS
- a refusal ends the pass but keeps and stores what it read; the next
  pass resumes from the cursor
- more than 50 min behind, skip to 5 min back and log 'skipped'
- reddit per-source floor 60 min -> 7 days: the firehose carries new
  posts, and per-sub asks spend the same per-IP budget
- drop the on-view refresh from #278 (bots read /r/* constantly, and each
  view would spend that budget too)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ralyodio added a commit that referenced this pull request Nov 9, 2026
…hour (#280)

Arctic Shift answers 422 'Timeout. Maybe slow down a bit' after ~5 back-
to-back pages (measured), and pages are capped at 100 (~6 s of Reddit). So:
- pages 4 s apart, 12 per pass, a pass every 60 s (~11/min, just over
  Reddit's pace); env REDDIT_FIREHOSE_GAP_MS / _PAGES / _MS
- a refusal ends the pass but keeps and stores what it read; the next
  pass resumes from the cursor
- more than 50 min behind, skip to 5 min back and log 'skipped'
- reddit per-source floor 60 min -> 7 days: the firehose carries new
  posts, and per-sub asks spend the same per-IP budget
- drop the on-view refresh from #278 (bots read /r/* constantly, and each
  view would spend that budget too)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant