Repository navigation
fix(backend): Redis接続復旧時に必要な購読を復元する - #74
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughRedis購読クライアントは自動再購読を無効にし、接続の ChangesRedis購読の復旧
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change restores host Redis subscriptions whenever the connection becomes ready, covering both a failed initial connection and a dropped connection. No regression was found. The remaining case is a SUBSCRIBE that Redis rejects while the connection stays open. That case already behaved the same way before this change and is not addressed by this PR. The change appears ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Redisが目覚めて、購読を始めます Comment |
|
このPRによるapi.jsonの差分 |
🖥 Frontend Diagnostics Report(No significant changes) Requests by resource type
V8 heap snapshot statistics
📦 Bundle StatsChunk size diff (0 updated, 0 added, 0 removed)
Startup chunk size (0 updated, 0 added, 0 removed)
Startup chunks are the Vite entry for
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
⚙️ Backend Diagnostics ReportMemory: After GC(No significant changes) V8 Heap Snapshot Statistics
|
What
Redis購読専用接続が
readyになるたびにホストのSUBSCRIBEを発行し、初回接続失敗後と確立済み購読の再接続後にイベント受信を復元します。購読の発行元をこの処理に統一するため
autoResubscribeを無効にし、SUBSCRIBEの失敗はログへ出します。Why
Closes #73
起動時に一度だけ発行したSUBSCRIBEは、接続障害がioredisの再試行上限を超えると破棄されます。
成功応答前は自動再購読の登録がないため、接続だけ復旧してイベント配信が停止したままになります。
修正前の実際のproviderとioredis 5.11.1で、
MaxRetriesPerRequestErrorの未処理と復旧後の購読者0を再現しました。Additional info (optional)
使い捨てのローカルRedis 7とTCPプロキシで、初回接続が再試行上限を超える場合と、確立済み購読を切断した場合の両方を検証しました。
各ケースで復旧後のPUBLISHに購読者1が返り、実際のメッセージ受信を確認しています。
テストは専用channel・専用購読接続だけを遮断します。
検証済み:
pnpm --filter backend test --run test/unit/GlobalModule.ts(backendビルドと2テスト成功)pnpm --filter backend typecheck(src / test / test-federation成功)node scripts/check-shipping.mjs --base origin/develop(変更ファイルlint / SPDX / locale safety成功)pnpm exec eslint --quiet test/unit/GlobalModule.ts(成功)healthの判定、ブラウザー側、本番watchdogは変更していません。
本番への障害注入・デプロイと、変更後の実環境WebSocket E2Eは未実施です。
本番で初回SUBSCRIBEが失敗した直接ログは未取得であり、今回確定したのはローカルでのコード経路の再現です。
API・entity・migrationの変更がないためSDK再生成・migration検査は対象外です。
CHANGELOGは未変更で、候補は「Redis接続復旧後に購読が復元されずリアルタイム配信が停止する問題を修正」です。
Checklist