Skip to content

fix(scrape): isolate site failures in ScrapeAction - #191

Merged
128na merged 2 commits into
masterfrom
fix/scrape-site-isolation
Aug 20, 2026
Merged

fix(scrape): isolate site failures in ScrapeAction#191
128na merged 2 commits into
masterfrom
fix/scrape-site-isolation

Conversation

@128na

@128na 128na commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • prodで8月中旬以降ほぼ毎日発生していた、Japanの一覧取得(?cmd=list)の接続タイムアウトが ScrapeAction の foreach 全体を中断させ、Twitrans/Portal のスクレイピングまで巻き添えで未実行になっていた問題を修正
  • ScrapeAction の各サイトハンドラ呼び出しをサイト単位の try/catch で囲み、1サイトの失敗が他サイトの処理を止めないようにした(docs/known-risks.md A1 の記録も実態に合わせて更新)
  • 同型の欠落が ExtractAction にも残っているが、今回はスコープ外として未対応

Test plan

  • php artisan test --filter=Scrape 全13件パス(新規テスト ScrapeActionTest::test_one_site_failure_does_not_stop_other_sites を含む)
  • phpstan analyse エラーなし
  • pint --test パス

🤖 Generated with Claude Code

128na and others added 2 commits August 20, 2026 19:22
Japan の一覧取得(?cmd=list)が接続タイムアウトで失敗すると、ScrapeAction
の foreach に try/catch が無いため例外が伝播し、Twitrans/Portal のスク
レイピングも丸ごとスキップされていた(prod で8月中旬以降ほぼ毎日発生)。
サイト単位で try/catch し、1サイトの失敗が他サイトを止めないようにする。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
コードレビュー指摘への対応。前回の修正(サイト毎 try/catch)は例外を
ScrapeAction 内で握りつぶしていたため、ScrapeCommand の catch まで
届かなくなり、report() 経由のDiscord通知・失敗時の終了コード・
last_crawl キャッシュ更新スキップが働かなくなっていた。

全サイトを試行した後、失敗が1件でもあれば最後に再送出することで、
「1サイトの失敗が他サイトを止めない」を保ったまま、失敗の可視化
(Discord通知/終了コード/last_crawl据え置き)を復元する。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@128na
128na merged commit d2f8482 into master Aug 20, 2026
5 checks passed
@128na
128na deleted the fix/scrape-site-isolation branch August 20, 2026 10:33
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