-
-
Notifications
You must be signed in to change notification settings - Fork 368
Remove dependency on Redis::Namespace #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@bschaeffer is redis-namespace causing you problems or do you just want to remove the extra dependency? I'm open to removing it and making it an optional extra, will have to bump the version to 3.0.0 in that case, fancy sending a pr? |
It's not causing me a problem at all, just thought it was an unneeded dependency that could be left up to the user. I am definitely open to sending a PR. My thoughts were:
Example: def redis=(server)
@redis = if server.is_a?(String)
Redis.new(url: server)
elsif server.is_a?(Hash)
Redis.new(server)
elsif server.respond_to?(:smembers)
server
else
raise ArgumentError,
"You must supply a url string, options hash or valid redis connection"
end
end We could check for any command before assigning the supplied connection. Could also eliminate the check all together and assume the user supplied a valid connection. If that looks good I'd be happy to send a PR. |
Yeah that looks good, pr would be awesome! |
@andrew I hesitated adding any additional documentation about removing the |
1 similar comment
@bschaeffer I think we're going to need to make this a little bit more backwards compatible, currently everyone who's using |
That sounds good. I am not used to contributing such breaking changes. Good catch and I'll be more than happy to make those changes. |
@andrew Made the change, and I'd be more than happy to rebase these commits. Up to you. |
1 similar comment
👍 |
* Rename redis_url config to redis * Remove dependency on redis-namespace * Add backwards compatible redis_url with deprecation
This seems to be a breaking change, in the sense that Split won't find my existing experiment data after upgrading, unless I manually reinstate the If so, it would probably be helpful to mention this more explicitly in the changelog. As stated above, a bump to 3.0 could have been appropriate. No harm done on my part, but I could see how this might bite someone else down the road. :) |
@lime I thought it was going to be a bump to 3.0. Workaround is to add redis = Redis::Namespace.new(url: 'redis://localhost:6379', namespace: 'split')
Split.redis = redis |
Sorry my mistake, should have been released as 3.0.0 |
I was just wondering how open everyone would be to a future version removing the dependency on
redis-namespace
.It seems like the
Split.redis=
is basically just doing some magic that accepts either:ENV['REDIS_URL']
or one supplied during configuration),Redis
instance, which is then namespaced automatically, orRedis::Namespace
instance.Right now, the URL doesn't necessarily need to adhere to the spec. I would be happy to work on a solution that simplifies the assignment to allow either:
ENV['REDIS_URL']
and would be passed as{url: self.configuration.redis_url}
toRedis.new
.Redis.new
.Redis
instance. If the user wants to useRedis::Namespace
, adding that dependency and supplying that connection would be up to them.Any thoughts? I know removing the dependency would break default installations, but the upgrade path would be as simple as adding
redis-namespace
and supplying that to the redis assignment.