Skip to content

Commit

Permalink
Redis options are now passed directly to Redis constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
take-five committed Apr 11, 2013
1 parent 12f5fc0 commit 089df13
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ redis:
host: bz-redis
port: 6379
namespace: blizko
thread_safe: true

resque:
interval: 5 # частота, с которой resque берет задачи из очереди в секундах (по умолчанию 5)
Expand Down
6 changes: 1 addition & 5 deletions lib/resque/integration/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ def initialize(*paths)
#
# @return [OpenStruct]
def redis
@redis ||= OpenStruct.new :host => self['redis.host'] || 'localhost',
:port => self['redis.port'] || 6379,
:db => self['redis.db'] || 0,
:thread_safe => self['redis.thread_safe'],
:namespace => self['redis.namespace']
@redis ||= (self['redis'] || {}).symbolize_keys.merge(:thread_safe => true)
end

# Returns workers configuration
Expand Down
5 changes: 3 additions & 2 deletions lib/resque/integration/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding: utf-8

require 'redis'
require 'redis/version'
require 'rails/engine'
require 'active_support/core_ext/string/inflections'
Expand Down Expand Up @@ -28,8 +29,8 @@ class Engine < Rails::Engine
initializer 'resque-integration.redis' do
redis = Resque.config.redis

Resque.redis = [redis.host, redis.port, redis.db].join(':')
Resque.redis.namespace = redis.namespace
Resque.redis = Redis.new(redis)
Resque.redis.namespace = redis[:namespace] if redis[:namespace]
end

# Конфигурирование плагина resque-failed-job-mailer.
Expand Down

0 comments on commit 089df13

Please sign in to comment.