Fix database in redis url
This MR fixes Redis connection. When a db
is specified in a url, it is correctly set in client
but not connection
.
Example:
redis = Redis.new(url: 'redis://localhost?db=4')
redis.client.options[:url]
=> "redis://localhost?db=4" # this is correct
redis.connection
=> {:host=>"localhost", :port=>6379, :db=>0, :id=>"redis://localhost:6379/0", :location=>"localhost:6379"} # db here is incorrect
When the db is passed as a separated option, it works:
redis = Redis.new(url: 'redis://localhost?db=4', db: 4)
redis.client.options[:url]
=> "redis://localhost?db=4"
redis.connection
=> {:host=>"localhost", :port=>6379, :db=>4, :id=>"redis://localhost:6379/4", :location=>"localhost:6379"}
Edited by Jarka Košanová