Skip to content

Commit

Permalink
Remove Faye mode
Browse files Browse the repository at this point in the history
No deprecation, because it was never documented.
  • Loading branch information
matthewd committed Oct 1, 2016
1 parent 9588a3d commit d44177d
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 175 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ env:
- "GEM=railties"
- "GEM=ap"
- "GEM=ac"
- "GEM=ac FAYE=1"
- "GEM=ac:integration"
- "GEM=ac:integration FAYE=1"
- "GEM=am,amo,as,av,aj"
- "GEM=as PRESERVE_TIMEZONES=1"
- "GEM=ar:mysql2"
Expand Down Expand Up @@ -69,7 +67,6 @@ matrix:
- rvm: ruby-head
- rvm: jruby-9.0.5.0
- env: "GEM=ac:integration"
- env: "GEM=ac:integration FAYE=1"
fast_finish: true

notifications:
Expand Down
4 changes: 0 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ task default: %w(test test:isolated)
FRAMEWORKS.each do |project|
system(%(cd #{project} && #{$0} #{task_name} --trace)) || errors << project
end
if task_name =~ /test/
system(%(cd actioncable && env FAYE=1 #{$0} #{task_name} --trace)) || errors << "actioncable-faye"
end
fail("Errors in #{errors.join(', ')}") unless errors.empty?
end
end
Expand All @@ -36,7 +33,6 @@ task :smoke do
system %(cd #{project} && #{$0} test:isolated --trace)
end
system %(cd activerecord && #{$0} sqlite3:isolated_test --trace)
system %(cd actioncable && env FAYE=1 #{$0} test:isolated --trace)
end

desc "Install gems for all projects."
Expand Down
2 changes: 0 additions & 2 deletions actioncable/lib/action_cable/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module Connection
autoload :ClientSocket
autoload :Identification
autoload :InternalChannel
autoload :FayeClientSocket
autoload :FayeEventLoop
autoload :MessageBuffer
autoload :Stream
autoload :StreamEventLoop
Expand Down
48 changes: 0 additions & 48 deletions actioncable/lib/action_cable/connection/faye_client_socket.rb

This file was deleted.

44 changes: 0 additions & 44 deletions actioncable/lib/action_cable/connection/faye_event_loop.rb

This file was deleted.

14 changes: 3 additions & 11 deletions actioncable/lib/action_cable/server/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Server
# in a Rails config initializer.
class Configuration
attr_accessor :logger, :log_tags
attr_accessor :use_faye, :connection_class, :worker_pool_size
attr_accessor :connection_class, :worker_pool_size
attr_accessor :disable_request_forgery_protection, :allowed_request_origins
attr_accessor :cable, :url, :mount_path

Expand Down Expand Up @@ -37,19 +37,11 @@ def pubsub_adapter
end

def event_loop_class
if use_faye
ActionCable::Connection::FayeEventLoop
else
ActionCable::Connection::StreamEventLoop
end
ActionCable::Connection::StreamEventLoop
end

def client_socket_class
if use_faye
ActionCable::Connection::FayeClientSocket
else
ActionCable::Connection::ClientSocket
end
ActionCable::Connection::ClientSocket
end
end
end
Expand Down
1 change: 0 additions & 1 deletion actioncable/test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def setup
server.config.logger = Logger.new(StringIO.new).tap { |l| l.level = Logger::UNKNOWN }

server.config.cable = ActiveSupport::HashWithIndifferentAccess.new(adapter: "async")
server.config.use_faye = ENV["FAYE"].present?

# and now the "real" setup for our test:
server.config.disable_request_forgery_protection = true
Expand Down
4 changes: 0 additions & 4 deletions actioncable/test/connection/client_socket_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ def on_error(message)
end

test "delegate socket errors to on_error handler" do
skip if ENV["FAYE"].present?

run_in_eventmachine do
connection = open_connection

Expand All @@ -49,8 +47,6 @@ def on_error(message)
end

test "closes hijacked i/o socket at shutdown" do
skip if ENV["FAYE"].present?

run_in_eventmachine do
connection = open_connection

Expand Down
2 changes: 0 additions & 2 deletions actioncable/test/connection/stream_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def on_error(message)

[ EOFError, Errno::ECONNRESET ].each do |closed_exception|
test "closes socket on #{closed_exception}" do
skip if ENV["FAYE"].present?

run_in_eventmachine do
connection = open_connection

Expand Down
15 changes: 3 additions & 12 deletions actioncable/test/stubs/test_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ def initialize(subscription_adapter: SuccessAdapter)
@logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)

@config = OpenStruct.new(log_tags: [], subscription_adapter: subscription_adapter)
@config.use_faye = ENV["FAYE"].present?
@config.client_socket_class = if @config.use_faye
ActionCable::Connection::FayeClientSocket
else
ActionCable::Connection::ClientSocket
end
@config.client_socket_class = ActionCable::Connection::ClientSocket

@mutex = Monitor.new
end
Expand All @@ -25,12 +20,8 @@ def pubsub
end

def event_loop
@event_loop ||= if @config.use_faye
ActionCable::Connection::FayeEventLoop.new
else
ActionCable::Connection::StreamEventLoop.new.tap do |loop|
loop.instance_variable_set(:@executor, Concurrent.global_io_executor)
end
@event_loop ||= ActionCable::Connection::StreamEventLoop.new.tap do |loop|
loop.instance_variable_set(:@executor, Concurrent.global_io_executor)
end
end

Expand Down
1 change: 0 additions & 1 deletion actioncable/test/subscription_adapter/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module CommonSubscriptionAdapterTest
def setup
server = ActionCable::Server::Base.new
server.config.cable = cable_config.with_indifferent_access
server.config.use_faye = ENV["FAYE"].present?

adapter_klass = server.config.pubsub_adapter

Expand Down
44 changes: 1 addition & 43 deletions actioncable/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,7 @@
# Require all the stubs and models
Dir[File.dirname(__FILE__) + "/stubs/*.rb"].each { |file| require file }

if ENV["FAYE"].present?
require "faye/websocket"
class << Faye::WebSocket
remove_method :ensure_reactor_running

# We don't want Faye to start the EM reactor in tests because it makes testing much harder.
# We want to be able to start and stop EM loop in tests to make things simpler.
def ensure_reactor_running
# no-op
end
end
end

module EventMachineConcurrencyHelpers
def wait_for_async
EM.run_deferred_callbacks
end

def run_in_eventmachine
failure = nil
EM.run do
begin
yield
rescue => ex
failure = ex
ensure
wait_for_async
EM.stop if EM.reactor_running?
end
end
raise failure if failure
end
end

module ConcurrentRubyConcurrencyHelpers
class ActionCable::TestCase < ActiveSupport::TestCase
def wait_for_async
wait_for_executor Concurrent.global_io_executor
end
Expand All @@ -56,14 +22,6 @@ def run_in_eventmachine
yield
wait_for_async
end
end

class ActionCable::TestCase < ActiveSupport::TestCase
if ENV["FAYE"].present?
include EventMachineConcurrencyHelpers
else
include ConcurrentRubyConcurrencyHelpers
end

def wait_for_executor(executor)
# do not wait forever, wait 2s
Expand Down

0 comments on commit d44177d

Please sign in to comment.