Skip to content

Commit

Permalink
Fix compatibility with Redis 5.0.7+ (#513)
Browse files Browse the repository at this point in the history
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
  • Loading branch information
casperisfine and byroot authored Dec 7, 2023
1 parent 7340489 commit 43a0b9d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
14 changes: 7 additions & 7 deletions Gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions gemfiles/redis_5.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/semian/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
require "redis"

if Redis::VERSION >= "5"
gem "redis", ">= 5.0.3"
gem "redis", ">= 5.0.7"
gem "redis-client", ">= 0.19.0"
require "semian/redis/v5"
return
end
Expand Down
6 changes: 2 additions & 4 deletions lib/semian/redis/v5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@ def semian_identifier
end

module RedisV5Client
private

def translate_error!(error)
redis_error = translate_error_class(error.class)
if redis_error < ::Semian::AdapterError
redis_error = redis_error.new(error.message)
redis_error.semian_identifier = semian_identifier
redis_error.semian_identifier = error.semian_identifier
end
raise redis_error, error.message, error.backtrace
end
end
end

::Redis.prepend(Semian::RedisV5)
::Redis::Client.prepend(Semian::RedisV5Client)
::Redis::Client.singleton_class.prepend(Semian::RedisV5Client)

0 comments on commit 43a0b9d

Please sign in to comment.