From 614dbfef7720167821b3ccac00c0b8d63f4b5703 Mon Sep 17 00:00:00 2001 From: Clemens Gruber Date: Thu, 19 Jul 2012 18:04:15 +0200 Subject: [PATCH] Added option to specify the redis driver (hiredis, ..) --- Changes.md | 1 + lib/sidekiq/redis_connection.rb | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changes.md b/Changes.md index cba2390a..c7edeaaf 100644 --- a/Changes.md +++ b/Changes.md @@ -5,6 +5,7 @@ HEAD This gives us a full Thread stack and also lowers Sidekiq's memory usage. - Add pagination for lists within the Web UI [#253] +- Add possibility to specify which Redis driver to use: *hiredis*, *synchrony* or *ruby* (default) 2.0.3 ----------- diff --git a/lib/sidekiq/redis_connection.rb b/lib/sidekiq/redis_connection.rb index ad04cd6b..40e5dfac 100644 --- a/lib/sidekiq/redis_connection.rb +++ b/lib/sidekiq/redis_connection.rb @@ -6,16 +6,17 @@ module Sidekiq class RedisConnection def self.create(options={}) url = options[:url] || ENV['REDISTOGO_URL'] || 'redis://localhost:6379/0' + driver = options[:driver] || 'ruby' # need a connection for Fetcher and Retry size = options[:size] || (Sidekiq.server? ? (Sidekiq.options[:concurrency] + 2) : 5) ConnectionPool.new(:timeout => 1, :size => size) do - build_client(url, options[:namespace]) + build_client(url, options[:namespace], driver) end end - def self.build_client(url, namespace) - client = Redis.connect(:url => url) + def self.build_client(url, namespace, driver) + client = Redis.connect(:url => url, :driver => driver) if namespace Redis::Namespace.new(namespace, :redis => client) else