mirror of
https://github.com/ShayManor/github-readme-stats.git
synced 2026-12-02 11:53:48 +05:30
feat(generator): raise enrollment ceiling, add burst guard, stop enqueue loop
ENROLLMENT_DAILY_CAP was 50, so any traffic spike past 50 new users in a day was turned away with a rate_limited card. Raise the default to 500 and add ENROLLMENT_HOURLY_CAP=60. The hourly guard is the one that actually protects the shared PAT: a new user costs ~37 REST calls (p90 ~104) against a 5000/hr budget, and a spike arrives inside an hour rather than spread over a day. Counted off users.enrolled_at, so no schema change. Also stop an unbounded enqueue loop. `name` is drawn inside the composite and never persisted standalone, and `achievements` renders nothing until the user authors one, so their SVG is permanently absent and every request re-enqueued a build that could never produce it. Only self-heal when no build has actually landed, keyed off widget_data for the current hash. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BwMoSbmK77Ph7XaV5YnAdS
This commit is contained in:
@@ -57,6 +57,18 @@ def test_enrollments_daily_counter(tmp_dbs):
|
||||
assert dbmod.enrollments_today() == 2
|
||||
|
||||
|
||||
def test_enrollments_last_hour_counts_only_recent(tmp_dbs):
|
||||
dbmod.enroll("alice", {"theme": "dark"})
|
||||
dbmod.enroll("bob", {"theme": "dark"})
|
||||
assert dbmod.enrollments_last_hour() == 2
|
||||
# Age one of them past the window; it must drop out of the burst count
|
||||
# while still counting toward the daily total.
|
||||
with dbmod._settings_conn() as c:
|
||||
c.execute("UPDATE users SET enrolled_at='2020-01-01T00:00:00Z' WHERE username='alice'")
|
||||
c.commit()
|
||||
assert dbmod.enrollments_last_hour() == 1
|
||||
|
||||
|
||||
def test_enrollment_rank_is_case_insensitive(tmp_dbs):
|
||||
"""GitHub returns logins with original casing ("ShayManor") but the users
|
||||
table stores them lowercased. Without normalization the founder-tag rule
|
||||
|
||||
Reference in New Issue
Block a user