Skip to content

Pace Classic Quiz report polling instead of hammering - #407

Open
dbosk wants to merge 1 commit into
masterfrom
fix/quiz-report-polling
Open

Pace Classic Quiz report polling instead of hammering#407
dbosk wants to merge 1 commit into
masterfrom
fix/quiz-report-polling

Conversation

@dbosk

@dbosk dbosk commented Aug 4, 2026

Copy link
Copy Markdown
Owner

The Classic Quiz report path looped 30 times around
poll_progress(report, max_attempts=1). With a single attempt, the sleep
guard inside poll_progress (attempt < max_attempts - 1) never fires, so
all 30 API calls went out back-to-back with no backoff.

The caller now hands poll_progress its full attempt budget in one call.
That required one addition to poll_progress itself: Classic QuizReport
objects are static snapshots with no query() method (the refresh previously
lived in the outer loop as quiz.get_quiz_report), so poll_progress gained
an optional refresh callback invoked before each check, and treats a
non-empty file attachment as completion — the signal the caller's success
path actually relies on. The fresh snapshot is returned so the download-URL
extraction sees the completed report, not a stale one. New Quiz behavior is
unchanged (Progress objects self-refresh via query).

Two regression tests (refresh-per-attempt with growing backoff sleeps;
already-finished report completes without sleeping), both proven load-bearing
against the pre-fix tangled code. Full suite: 471 passed (baseline 469).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pb27a9hf6eNoetEWryx2fj

The Classic Quiz report path looped 30 times around
poll_progress(report, max_attempts=1). With a single attempt the
poller's sleep guard (attempt < max_attempts - 1) never fires, so all
30 API requests went out back-to-back with no backoff.

Hand poll_progress the whole attempt budget in one call instead. Since
QuizReport objects are static snapshots (no query() method), add an
optional refresh callback so the poller can re-fetch the report between
attempts, and treat a report's generated file attachment as the
completion signal so the fresh snapshot is returned for URL extraction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pb27a9hf6eNoetEWryx2fj
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