Fix ActionCable Redis configuration with sentinels #48321
Merged
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.
Motivation / Background
This pull request addresses an integration bug between ActionCable and Redis >= 5.0 when using sentinels configuration. The bug causes issues because the sentinels configuration is a nested array of hashes, whereas the Redis client expects keys to be symbols. The proposed changes in this pull request modify the preparation of the Redis configuration to ensure that all keys are properly represented as symbols. This fix resolves the problem and improves the compatibility between ActionCable and Redis with sentinels.
cc: @byroot
Detail
It is possible to reproduce within this repo https://github.com/moofkit/actioncable-redis-sentinel-bug
The problem is config for the cable parsed from YAML file and sentinels are deep nested hash in the array. But redis client expecting keys to be symbols, in the result it raises error
ArgumentError: unknown keywords: "host", "port"
in the redis-clientThis issue can be fixed within application with this initializer code
A redis-client related discussion: redis-rb/redis-client#121
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]