fix(scrape): isolate site failures in ScrapeAction - #191
Merged
Conversation
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>
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.
Summary
?cmd=list)の接続タイムアウトがScrapeActionの foreach 全体を中断させ、Twitrans/Portal のスクレイピングまで巻き添えで未実行になっていた問題を修正ScrapeActionの各サイトハンドラ呼び出しをサイト単位の try/catch で囲み、1サイトの失敗が他サイトの処理を止めないようにした(docs/known-risks.mdA1 の記録も実態に合わせて更新)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