Skip to content

fix(update_stats): fetch downloads with a throttle npm accepts - #44

Open
pyramation wants to merge 1 commit into
constructive-io:mainfrom
pyramation-studio:fix/update-stats-throttle
Open

pyramation wants to merge 1 commit into
constructive-io:mainfrom
pyramation-studio:fix/update-stats-throttle

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

update_stats.sh ran npm:fetch:downloads with the fetcher's defaults (2 at a time, 2500ms apart). npm blocks that with 429 after ~20 packages, so the 2026-10-16 refresh used up all 10 retry attempts with ~950 packages still to fetch.

  • Fetch one package at a time, 3000ms apart, for both the normal fetch and the backfill. Override with FETCH_CONCURRENT / FETCH_DELAY.
  • packages/stats-db/README.md: the "conservative" setting goes from --delay 1500 to --delay 3000.

Measured against npm:

Setting Result
defaults (-c 2 -d 2500) 429 after ~22 packages, every attempt
-c 1 -d 1500 (old README recommendation) 429 after 20 packages (37s)
-c 1 -d 3000 931 packages, 0 429s (~50 min)

A full refresh of ~1150 packages now takes about an hour.

🤖 Generated with Claude Code

https://claude.ai/code/session_012tvNcsFXLSSXxetcU8UgV4

update_stats.sh ran npm:fetch:downloads with the fetcher's defaults (2 at a
time, 2500ms apart), which npm blocks with 429 after ~20 packages, so a run
with ~1000 packages to fetch ran out of its 10 attempts. Fetch one package at
a time, 3000ms apart (overridable with FETCH_CONCURRENT / FETCH_DELAY), for
both the normal fetch and the backfill.

The README's conservative 1500ms delay was also blocked after ~20 packages
in Oct 2026; 3000ms fetched 931 packages with no 429s, so the README now
recommends that.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012tvNcsFXLSSXxetcU8UgV4
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