From 64269bac00e41f19d91e00748d97aedfb23ccb44 Mon Sep 17 00:00:00 2001 From: Todd Dickerson Date: Tue, 27 Feb 2018 14:49:00 -0500 Subject: [PATCH] Redis 4 support --- lib/rack/redis_throttle/connection.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rack/redis_throttle/connection.rb b/lib/rack/redis_throttle/connection.rb index cd4667c..e7f4768 100644 --- a/lib/rack/redis_throttle/connection.rb +++ b/lib/rack/redis_throttle/connection.rb @@ -7,7 +7,8 @@ class Connection def self.create(options={}) url = redis_provider || 'redis://localhost:6379/0' options.reverse_merge!({ url: url }) - client = Redis.connect(url: options[:url], driver: :hiredis) + uri = URI.parse(options[:url]) + client = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password, driver: :hiredis) Redis::Namespace.new("redis-throttle:#{ENV['RACK_ENV']}:rate", redis: client) end