Skip to content

Commit

Permalink
fix: add support for redis >= v4
Browse files Browse the repository at this point in the history
  • Loading branch information
isqad committed Dec 21, 2018
1 parent 61b44e2 commit d7478c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/resque/integration/tasks/hooks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ namespace :resque do
end

Resque.before_fork do
Resque.redis.client.disconnect
client = if Gem::Version.new(::Redis::VERSION) < Gem::Version.new('4')
Resque.redis.client
else
Resque.redis._client
end
client.disconnect

ActiveRecord::Base.connection_handler.clear_all_connections!
end
Expand All @@ -36,7 +41,12 @@ namespace :resque do

ActiveRecord::Base.establish_connection

Resque.redis.client.connect
client = if Gem::Version.new(::Redis::VERSION) < Gem::Version.new('4')
Resque.redis.client
else
Resque.redis._client
end
client.connect
end

# Support for resque-multi-job-forks
Expand Down

0 comments on commit d7478c2

Please sign in to comment.