ActionController::Live concurrent clients

17 views
Skip to first unread message

Arindam Mukherjee

unread,
Aug 25, 2016, 10:10:58 PM8/25/16
to Phusion Passenger Discussions
I have a controller that includes the ActionController::Live mixin to send SSE to the client. I notice that multiple concurrent connections don't make simultaneous progress - only one at a time.

I set config.allow_concurrency = true in config/application.rb but that makes no difference.

I am using Passenger 5.0.x (not sure of exact release version).

Camden Narzt

unread,
Aug 26, 2016, 9:59:46 AM8/26/16
to Phusion Passenger Discussions

Arindam Mukherjee

unread,
Aug 26, 2016, 1:21:54 PM8/26/16
to phusion-...@googlegroups.com
Thanks. We are using a rather old version of Phusion Passenger - 5.0.7.

I tried putting in `PhusionPassenger.advertised_concurrency_level = 0`
in `config.ru` file. It didn't make a difference.

FWIW, here is the controller action:

class FoosController < ApplicationController
include ActionController::Live

def notify
response.headers['Content-Type'] = 'text/event-stream'
sse = SSE.new(response.stream, event: 'foo.bar')

begin
100.times do |i|
sse.write({'data' => "Hello, world!\n"})
sleep 0.2
end
rescue
puts "sse exception"
ensure
sse.close
end
end

end
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Phusion Passenger Discussions" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/phusion-passenger/mldgia9cvBM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/phusion-passenger.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/phusion-passenger/830fc1fb-a81a-4a4d-9524-36d1eed76abc%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Arindam Mukherjee

unread,
Aug 26, 2016, 1:31:27 PM8/26/16
to phusion-...@googlegroups.com
I missed the `render nothing: true` at the end of the function.

Regards,
Arindam
Reply all
Reply to author
Forward
0 new messages