Repository navigation
fix: Redis/Dragonfly connection resilience and job ID collisions - #284
Merged
Merged
Conversation
- Add lib/redis.ts with shared URL resolution, protocol: 2 and a never-give-up reconnect strategy (capped at 5s) for both the cache adapter and the delivery queue - Wait up to 15s for the first ready event instead of failing on the first connection error, so a late Dragonfly start no longer disables the queue and cache for the process lifetime - Log a warning once per outage and an info message on recovery - Generate job IDs from a SHA-256 digest with a d- prefix: no collisions between deliveries and never integer-like (rejected by BullMQ) Claude-Session: https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv
#281) - Drop --cache_mode=true so Dragonfly never evicts queue keys; every cache entry already sets a TTL - Start the backend only after Dragonfly is healthy - Comment out REDIS_URL in .env.example so a copied .env does not override the DRAGONFLY_URL set by compose and the devcontainer Claude-Session: https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv
@simplewebauthn/server v14 exports AuthenticatorTransport itself. Claude-Session: https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
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. Comment |
The startup timeout error included the raw REDIS_URL/DRAGONFLY_URL, which can contain a password and is logged at warn level. Claude-Session: https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv
Member
Author
|
追加のコミット(17c814a): 起動時のタイムアウトのエラーメッセージに、Redis の URL がそのまま入っていました。URL にパスワードが含まれていると warn ログに出てしまうので、ユーザー名とパスワードを |
This was referenced Oct 14, 2026
Merged
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.
Closes #281
#274 で backend が実際に Dragonfly へ接続するようになったことで表に出た問題を、まとめて直します(/code-review の指摘 1〜7)。
変更内容
接続の扱い(新規ファイル
lib/redis.tsにまとめ、キャッシュとキューの両方から使う)warnを 1 回、復帰したときにinfoを 1 回出します。正常に終了するときは何も出しません。REDIS_URL→DRAGONFLY_URL→ localhost)とprotocol: 2の設定を 1 か所にまとめ、2 つのファイルの重複をなくしました。ジョブ ID
d-+ SHA-256 の先頭 128 ビット(16 進数)にしました。別々の配信が同じ ID になって捨てられることがなくなり、数字だけの ID(BullMQ が拒否する)もできなくなります。compose / env
--cache_mode=trueを外しました。これで BullMQ のキーが追い出されなくなります。キャッシュは全部 TTL 付きで保存しているので、キャッシュが消えずにたまり続けることもありません。docker/compose.yml: backend は Dragonfly が healthy になってから起動するようにしました(service_healthy)。.env.example:REDIS_URLをコメントアウトしました。例からコピーした.envが、compose のDRAGONFLY_URLより優先されてしまうのを防ぐためです。依存
@simplewebauthn/typesを削除し、AuthenticatorTransportを@simplewebauthn/serverから import するようにしました。本番の K8s は
--cache_modeを使っておらず、.env.exampleも使っていないので、本番に関係するのは「接続の扱い」と「ジョブ ID」の 2 つです。確認したこと
https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv