Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate the EventMachine dependency #23152

Merged
merged 3 commits into from
Jan 24, 2016
Merged

Conversation

matthewd
Copy link
Member

@pixeltrix pointed out that it wasn't actually all that infeasible for us to just import the portion of faye-websocket we need... it turns out to only be about 200 lines. So I did that.

All the protocol complexities live in websocket-driver, which we're still using, so we're not taking on any substantial maintenance burden.

For this relatively low cost, I'd contemplate this just to reduce our dependency list by the one gem... but the important part here is that by importing it, we're able to (as I have) then modify it to avoid EventMachine.

@schneems
Copy link
Member

👏

return true if env['rack.url_scheme'] == 'https'

return false
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can utilise Rack::Request#ssl? for this can't we?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.. I'll look at chasing env -> req right through in a subsequent change, because I imagine that'll make @tenderlove happy.

@pixeltrix
Copy link
Contributor

@matthewd 👍 - does this mean we could run it all in one server in development mode?

@kddnewton
Copy link
Contributor

@matthewd 👍 Does this mean there's work to be done on reloading?

@matthewd matthewd force-pushed the actioncable-concurrent branch 2 times, most recently from 07fbf3f to 65e3232 Compare January 21, 2016 17:57
headers.each { |name, value| @driver.set_header(name, value) }
end

[*options[:extensions]].each do |extension|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use two different array handling styles between :headers and :extensions?

@matthewd matthewd force-pushed the actioncable-concurrent branch 2 times, most recently from 070ada8 to 73bf1a5 Compare January 21, 2016 21:46
[ -1, {}, [] ]
end


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✂️ extra space

(as adapted to use concurrent-ruby / nio4r instead of eventmachine)
We're no longer doing our work in the EM event loop, so errors are quite
unlikely, and if they do occur, they're not really our responsibility to
handle.
dhh added a commit that referenced this pull request Jan 24, 2016
Eliminate the EventMachine dependency
@dhh dhh merged commit 53a9da4 into rails:master Jan 24, 2016
@todo = Queue.new

Thread.new do
Thread.current.abort_on_exception = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't want this.

claudiob added a commit to claudiob/rails that referenced this pull request Jan 26, 2016
Since rails#23152 eliminated the EventMachine dependency, we don’t need to
explicitly mention EventMachine.

Nevertheless, I'm not 100% sure about saying "the websocket-driver loop"
driver… any suggestions, @matthewd or @pixeltrix ? 😅

[ci skip]
@dhh
Copy link
Member

dhh commented Jan 27, 2016

Testing this with Basecamp, we're getting two separate exceptions. First:

/u/apps/bc3/shared/bundle-ruby221/ruby/2.2.0/bundler/gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:56:in `read_nonblock': Connection reset by peer (Errno::ECONNRESET)
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:56:in `block (2 levels) in run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:51:in `each'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:51:in `block in run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:40:in `loop'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:40:in `run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:14:in `block in initialize'

Which then leads to:

/u/apps/bc3/shared/bundle-ruby221/ruby/2.2.0/bundler/gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/base.rb:132:in `on_close': wrong number of arguments (2 for 0) (ArgumentError)
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/client_socket.rb:148:in `finalize_close'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/client_socket.rb:102:in `client_gone'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream.rb:24:in `close'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:60:in `rescue in block (2 levels) in run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:55:in `block (2 levels) in run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:51:in `each'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:51:in `block in run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:40:in `loop'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:40:in `run'
from /gems/rails-755f7b58953c/actioncable/lib/action_cable/connection/stream_event_loop.rb:14:in `block in initialize'

@matthewd matthewd deleted the actioncable-concurrent branch June 11, 2017 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants