バックフィルのハング対策とエラー可視化#146
Merged
Merged
Conversation
conversations.history のレートリミット(429)時に WebClient の デフォルトリトライ(tenRetriesInAboutThirtyMinutes)が効き、 最大約30分サイレントにリトライしてバックフィルがハングする問題を修正。 - web クライアントのリトライを fiveRetriesInFiveMinutes に短縮 - fetchChannel の catch でエラー種別(ratelimited等)を出力 - バックフィルの同時実行数を 5→2 に抑制 Co-Authored-By: Claude Opus 4.8 <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.
背景
起動時バックフィルが
Backfill progress: 0/38 channels (0%), 0 messages fetchedを延々と出力したまま完了せずハングする事象が発生していた。進捗ログは30秒インターバル(
lib/core.js:749)とバッチ完了時(lib/core.js:753)から出力される。processedChannelsは成功・失敗どちらでもfetchChannel末尾で必ずインクリメントされるため、これが 0 のまま = 最初のバッチのチャンネルすら1つも完了していない、つまりweb.conversations.history()の await でハングしていると判断した。原因
webクライアントがretryConfig未指定で、Slack SDK デフォルトのtenRetriesInAboutThirtyMinutesが効いていた。conversations.historyはレートリミットが厳しく、起動時に38チャンネルへ concurrency 5 で一斉に叩くと即 429 を食らい、約30分サイレントにリトライし続けてハングしていた。fetchChannelの catch がエラーを握りつぶしており(returnのみ)、レートリミットなのかスコープ不足なのか原因がログに残らなかった。変更内容
webクライアントのリトライをretryPolicies.fiveRetriesInFiveMinutesに短縮し、長時間ハングを防止fetchChannelの catch でエラー種別(ratelimited/missing_scope/not_in_channel等)をチャンネルラベル付きで出力テスト
npm test(lint + mocha)全て通過(62 passing)🤖 Generated with Claude Code