fix: 提出ページが404のコンテストは即スキップしてクロールを高速化する#1531
Open
kenkoooo wants to merge 1 commit into
Open
Conversation
submissions のクロールで404も他のエラーと同様に最大10回・指数 バックオフ(2s→…→1024s, 約34分)でリトライしており、提出ページが 404を返す古い/非公開コンテスト1件ごとに大量の時間を浪費していた。 これにより crawl-new / crawl-all が1周しきれず、abc308/358/410 など 古いコンテストへの提出が反映されない一因となっていた (#1518, #1520)。 fetch_submissions が404を CrawlerError::NotFound として返すようにし (fetch_problems と同じ扱い)、リトライ層では404を即スキップ。429や 5xx など他のエラーは従来どおりリトライする。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景 / 原因
issue #1518 / #1520 で「abc308 / abc358 / abc410(CodeQUEEN 予選に流用された回)への 2026-01 以降の提出が反映されない」と報告されている。AWS(ECS + CloudWatch Logs)で本番クローラのログを確認したところ、コンテスト固有の問題ではなく 古い全コンテスト共通の取りこぼしであり、原因は提出クロールの周回が遅すぎることだった。
submissions のクロール (
crawler_utils::fetch_submissions) は すべてのエラーを一律に最大10回・指数バックオフ(2s→4s→…→1024s, 合計約34分)でリトライする。提出ページが 404 を返す古い/非公開コンテストに対してもこのリトライが走るため、該当コンテスト1件につき最大約34分を空費していた。実際のログでは:
crawl-newが起動から5時間以上経っても1周目の途中で、404 を返すコンテストのリトライ(attempt 10/10)で延々と待たされていたcrawl-allは別要因(巨大コンテストの全ページクロール)で詰まるその結果、古いコンテストを唯一カバーできる
crawl-new/crawl-allが1周しきれず、abc308 等への新規提出が反映されなかった。なお
fetch_problems側はすでに 404 をCrawlerError::NotFoundで即スキップしており、submissions 側だけこの分岐が欠けていた。変更
crawler/src/client.rsのfetch_submissions: 404 をCrawlerError::NotFoundとして返す(fetch_problemsと同じ扱い)crawler_utils.rsのfetch_submissions(リトライ層):NotFoundはリトライせず即スキップ。429(Too Many Requests) や 5xx など他のエラーは従来どおりリトライする効果
404 コンテストでの最大約34分の浪費がなくなり、
crawl-newの1周時間が大幅に短縮される。古いコンテスト(abc308/358/410 含む)への提出も現実的な周期で拾われるようになる。レート制限/一時障害に対するリトライ耐性は維持。確認
cargo build --bin crawl-submissionsパスcargo clippy -p crawler --all-targets -- -D warnings/cargo clippy --bin crawl-submissions -- -D warningsパスCloses #1518
Closes #1520
🤖 Generated with Claude Code