Skip to content

Fix RTM reconnection failure after PC resume#120

Merged
hideack merged 1 commit into
masterfrom
feature/rtm-reconnect-on-resume
Apr 8, 2026
Merged

Fix RTM reconnection failure after PC resume#120
hideack merged 1 commit into
masterfrom
feature/rtm-reconnect-on-resume

Conversation

@hideack
Copy link
Copy Markdown
Owner

@hideack hideack commented Apr 8, 2026

Summary

  • PC のスリープ復帰後にネットワークが即座に利用できない場合、ENOTFOUND slack.com エラーで RTM クライアント組み込みのリトライが尽きると unable_to_rtm_start が発火し、以後接続が復旧しない問題を修正

変更内容

  • isNetworkError() ヘルパーを追加: ENOTFOUND / ECONNREFUSED / ETIMEDOUT / getaddrinfo を含むエラーをネットワークエラーと判定
  • scheduleRtmRestart() を追加: 指数バックオフ(5s → 10s → 20s → 最大 60s)でリトライをスケジュール
  • unable_to_rtm_start ハンドラでネットワークエラー検出時に自動リトライを開始
  • authenticated ハンドラでリトライカウンタをリセット

動作

状態 動作
復帰直後(ネットワーク未回復) 5s 後にリトライ、失敗なら 10s、20s、… 最大 60s 間隔で再試行
ネットワーク回復後 認証成功でカウンタリセット、通常動作に戻る
ネットワーク以外のエラー 従来通りログのみ(リトライなし)

Test plan

  • スリープ → 復帰後に自動再接続されることを手動確認
  • 認証成功後に rtmRestartAttempts がリセットされることを確認

🤖 Generated with Claude Code

When a PC resumes from sleep, the network may not be immediately
available, causing ENOTFOUND errors that exhaust the RTM client's
built-in retries. The unable_to_rtm_start handler now detects network
errors and schedules automatic restarts with exponential backoff
(5s, 10s, 20s, ... up to 60s cap) until the connection succeeds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hideack hideack merged commit 5d588b4 into master Apr 8, 2026
2 checks passed
@hideack hideack deleted the feature/rtm-reconnect-on-resume branch April 8, 2026 22:41
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