Redis adapter causes errors with Redis::Cluster due to monkey-patching
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
Research direction
Start with lib/semian/redis/v5.rb, especially Semian::RedisV5Client#translate_error!, and compare its method signature with Redis::Client.translate_error! and the Redis::Cluster delegation described in the issue. Verify the adapter remains compatible with the mapping keyword and reproduce the reported ArgumentError using the listed Redis and redis-clustering versions.
Written by the indexing model from the issue text.
Description
Semian::RedisV5Client#translate_error! overrides Redis::Client.translate_error! via prepend but doesn't preserve the original method signature. This might cause an ArgumentError when used alongside the redis-clustering gem.
This can happen even if you do not pass the semian argument to a Redis::Cluster class
def translate_error!(error, mapping: ERROR_MAPPING)
redis_error = translate_error_class(error.class, mapping: mapping)
raise redis_error, error.message, error.backtrace
end
Semian's patch:
Now when Redis::Cluster::Client calls its translate_error!, it would delegate to Redis::Client:
def translate_error!(error, mapping: ERROR_MAPPING)
case error
when RedisClient::Cluster::ErrorCollection
# nothing in particular
else
Redis::Client.translate_error!(error, mapping: mapping) # <---- DELEGATES HERE
end
end
But the Semian's patch breaks the API, which causes a ArgumentError: wrong number of arguments (given 2, expected 1).
Tested with:
semian 0.27.1 (latest)
redis 5.4.1 (latest)
redis-clustering 5.4.1 (latest)
redis-client 0.26.4 (latest)
But likely it's been an issue for longer.
- Dominant language
- Ruby
- Stars
- 1.5k
- Forks
- 88
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/semian
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100