{"action":"created","issue":{"url":"https://api.github.com/repos/resque/resque/issues/1258","labels_url":"https://api.github.com/repos/resque/resque/issues/1258/labels{/name}","comments_url":"https://api.github.com/repos/resque/resque/issues/1258/comments","events_url":"https://api.github.com/repos/resque/resque/issues/1258/events","html_url":"https://github.com/resque/resque/issues/1258","id":45927721,"number":1258,"title":"[2.0] Problems with `Resque.redis=` vs. `Resque::Config#redis=`","user":{"login":"davidcelis","id":36873,"avatar_url":"https://avatars.githubusercontent.com/u/36873?v=3","gravatar_id":"","url":"https://api.github.com/users/davidcelis","html_url":"https://github.com/davidcelis","followers_url":"https://api.github.com/users/davidcelis/followers","following_url":"https://api.github.com/users/davidcelis/following{/other_user}","gists_url":"https://api.github.com/users/davidcelis/gists{/gist_id}","starred_url":"https://api.github.com/users/davidcelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidcelis/subscriptions","organizations_url":"https://api.github.com/users/davidcelis/orgs","repos_url":"https://api.github.com/users/davidcelis/repos","events_url":"https://api.github.com/users/davidcelis/events{/privacy}","received_events_url":"https://api.github.com/users/davidcelis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-10-15T22:27:08Z","updated_at":"2015-04-04T03:08:37Z","closed_at":null,"body":"Hey guys; I just found this problem while investigating davidcelis/recommendable#98. There are discrepancies between assigning a Redis client in the two main ways it provides.\r\n\r\nFirst, there is this pattern:\r\n\r\n```ruby\r\nResque.configure do |config|\r\n  config.redis = 'redis://localhost:6379'\r\nend\r\n```\r\n\r\nThis merely assigns the `redis` attribute on Resque's config object. However, then there's `Resque.redis=`...\r\n\r\n```ruby\r\nResque.redis = 'redis://localhost:6379'\r\n```\r\n\r\nThis passes through to `config.redis = ...` and _also_ initializes Resque's `@backend` and `@queues` ivars. What this means is that if somebody uses the configuration pattern (which I would expect to be the _main_ pattern to assign a Redis instance), those ivars never get assigned. The problem in davidcelis/recommendable#98 was specifically that `@queues` was nil, which would cause problems when trying to enqueue a Resque job.\r\n\r\nI'd like to submit a patch for this, but wanted to check in on the desired approach. IMO Resque should by default try to connect to Redis on localhost:6379 by default (maybe it already is?) and those ivars should probably be initialized elsewhere (or both from `Resque.redis=` and `Resque.configure { ... }`."},"comment":{"url":"https://api.github.com/repos/resque/resque/issues/comments/89491718","html_url":"https://github.com/resque/resque/issues/1258#issuecomment-89491718","issue_url":"https://api.github.com/repos/resque/resque/issues/1258","id":89491718,"user":{"login":"dfockler","id":2158103,"avatar_url":"https://avatars.githubusercontent.com/u/2158103?v=3","gravatar_id":"","url":"https://api.github.com/users/dfockler","html_url":"https://github.com/dfockler","followers_url":"https://api.github.com/users/dfockler/followers","following_url":"https://api.github.com/users/dfockler/following{/other_user}","gists_url":"https://api.github.com/users/dfockler/gists{/gist_id}","starred_url":"https://api.github.com/users/dfockler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfockler/subscriptions","organizations_url":"https://api.github.com/users/dfockler/orgs","repos_url":"https://api.github.com/users/dfockler/repos","events_url":"https://api.github.com/users/dfockler/events{/privacy}","received_events_url":"https://api.github.com/users/dfockler/received_events","type":"User","site_admin":false},"created_at":"2015-04-04T03:08:37Z","updated_at":"2015-04-04T03:08:37Z","body":"@davidcelis When you do `Resque.redis = Redis.new` it will set the defaults to `redis://127.0.0.1:6379`, I think `configure` was meant more for if you weren't going to use Redis as the backend or if you needed something other than `Hash`"}}