-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Rolling Restarts with Rails ActionController::Live #569
Comments
Having the same issue, puma_worker_killer doesn't restart a worker until after a user disconnects. Did you find a way to solve this properly? Could interrupt the SSEs from the server, but don't want to interrupt all the SSEs, would like to shut only the connections created by the worker which is shutting down.. |
I decided using a separate server for SSEs. I used this gem http://mikeatlas.github.io/realtime-rails/ first, but the node server proposed here uses websockets, which didn't work for me due to infrastructure restrictions. So I made a similar express.js server with SSEs and kept using the same gem server side for authentication. Let me know if you need to use the SSE version. |
Tried to keep the ActionController::Live streaming inside my main app, and indeed I have the same issue: I tried to shut down all the SSEs for the worker I want to restart by fetching the index of the worker in the SSE loop: ObjectSpace.each_object(Puma::Cluster::Worker).map { |obj| obj }.first.try(:index) But this is not enough: I have to close ALL SSEs connections for ALL workers in my app before being able to restart a particular worker, even the connections on other workers. Seems like a bug to me (from Puma cluster, not from ActionController::Live?) and that makes ActionController::Live with Puma not scalable. => Feature request: be able to restart a worker even if some (SSEs) processes on other workers are running? |
Any solution for this? |
You'll be able to use |
Hello,
we have a live controller in our rails app, with an action streaming new alerts to users. We have implemented the heartbeat solution as described here rails/rails#10989
We can't however do a rolling restart when at least one open session exists. As soon as the user closes the client and the heartbeat kicks in, the thread is killed and the restart goes on, but until then Puma remains down. This is n't a situation we can handle on production of course, so I thought I'd ask how anyone else has handled it. Otherwise live controllers are pretty much useless.
The text was updated successfully, but these errors were encountered: