Skip to content

バックフィルのハング対策とエラー可視化#146

Merged
hideack merged 1 commit into
masterfrom
fix/backfill-hang-ratelimit
Jul 20, 2026
Merged

バックフィルのハング対策とエラー可視化#146
hideack merged 1 commit into
masterfrom
fix/backfill-hang-ratelimit

Conversation

@hideack

@hideack hideack commented Jul 20, 2026

Copy link
Copy Markdown
Owner

背景

起動時バックフィルが 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 等)をチャンネルラベル付きで出力
  • バックフィルの同時実行数を 5→2 に抑制してレートリミットを踏みにくくする

テスト

  • npm test(lint + mocha)全て通過(62 passing)

🤖 Generated with Claude Code

conversations.history のレートリミット(429)時に WebClient の
デフォルトリトライ(tenRetriesInAboutThirtyMinutes)が効き、
最大約30分サイレントにリトライしてバックフィルがハングする問題を修正。

- web クライアントのリトライを fiveRetriesInFiveMinutes に短縮
- fetchChannel の catch でエラー種別(ratelimited等)を出力
- バックフィルの同時実行数を 5→2 に抑制

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hideack
hideack merged commit 7a29662 into master Jul 20, 2026
2 checks passed
@hideack
hideack deleted the fix/backfill-hang-ratelimit branch July 20, 2026 02:06
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