Permalink
Browse files

Backport #30748 for redis-rb 4.0 support

Rails master adds support for redis-rb 4.0 but when Rails 5-1-stable
branch gets an updated redis there are exceptions in the travis log.

```
Error:
RedisAdapterTest#test_channel_filtered_broadcast:
Gem::LoadError: Specified 'redis' for Action Cable pubsub adapter, but
the gem is not loaded. Add `gem 'redis'` to your Gemfile (and ensure its
version is at the minimum required by Action Cable).
```

This PR backports Jeremy's work so that the build can be green.

[Eileen M. Uchitelle & Jeremy Daer]
  • Loading branch information...
eileencodes committed Dec 8, 2017
1 parent 532c8a8 commit 37895311514a35333e5597018852eb0fe2c9eb28
@@ -1,7 +1,7 @@
require "thread"
gem "em-hiredis", "~> 0.3.0"
gem "redis", "~> 3.0"
gem "redis", ">= 3", "< 5"
require "em-hiredis"
require "redis"
@@ -1,6 +1,6 @@
require "thread"
gem "redis", "~> 3.0"
gem "redis", ">= 3", "< 5"
require "redis"
module ActionCable
@@ -72,7 +72,7 @@ def initialize(adapter, event_loop)
def listen(conn)
conn.without_reconnect do
original_client = conn.client
original_client = conn.respond_to?(:_client) ? conn._client : conn.client
conn.subscribe("_action_cable_internal") do |on|
on.subscribe do |chan, count|
View
@@ -1,3 +1,7 @@
* Gemfile for new apps: upgrade redis-rb from ~> 3.0 to 4.0.
*Jeremy Daer*
## Rails 5.1.4 (September 07, 2017) ##
* No changes.
@@ -1,7 +1,7 @@
module ResqueJobsManager
def setup
ActiveJob::Base.queue_adapter = :resque
Resque.redis = Redis::Namespace.new "active_jobs_int_test", redis: Redis.connect(url: "redis://127.0.0.1:6379/12", thread_safe: true)
Resque.redis = Redis::Namespace.new "active_jobs_int_test", redis: Redis.new(url: "redis://127.0.0.1:6379/12", thread_safe: true)
Resque.logger = Rails.logger
unless can_run?
puts "Cannot run integration tests for resque. To be able to run integration tests for resque you need to install and start redis.\n"
@@ -39,11 +39,8 @@ def stop_workers
end
def can_run?
begin
Resque.redis.client.connect
rescue
return false
end
true
Resque.redis.ping == "PONG"
rescue
false
end
end
View
@@ -1,3 +1,7 @@
* Gemfile for new apps: upgrade redis-rb from ~> 3.0 to 4.0.
*Jeremy Daer*
## Rails 5.1.4 (September 07, 2017) ##
* No changes.
@@ -364,7 +364,7 @@ def cable_gemfile_entry
return [] if options[:skip_action_cable]
comment = "Use Redis adapter to run Action Cable in production"
gems = []
gems << GemfileEntry.new("redis", "~> 3.0", comment, {}, true)
gems << GemfileEntry.new("redis", "~> 4.0", comment, {}, true)
gems
end

0 comments on commit 3789531

Please sign in to comment.