Search code examples
ruby-on-railsrubyherokuactioncontrollerpuma

Heroku-Puma-ActionController:Live not allowing multiple requests


I'm in the process of making a web app using Rails that maps tweets from the Twitter Streaming API onto a mapbox map. It uses Puma as the server and ActionController:Live to create a http connection with the client to push the new tweets. The Twitter Stream is being opened via a "worker" and publishes tweets to redis, and then on my "stream" controller, I have a redis subscription that listens for tweets and then sends them to the client.

My app currently works fine locally, I can open multiple tabs and all clients receive the tweets, but when I push to Heroku it only works for one client at a time. It used to work fine earlier and I have literally not changed any puma settings.

The Heroku deployed version seems as if its not longer multi-threaded. Not sure how or why.

This is a link to the github repo if anyone would like to see the code: github repo

edit- Going to try changing to Faye websocket, but I don't think the problem is connected to the websocket seeing as the single connection that gets established first works perfectly, its just all the ones after get rejected by 503 errors.


Solution

  • This was a problem related to initiating the Puma server with a set amount of worker processes. Removing the set number of processes and leaving it to the default fixed it.

    # workers Integer(ENV['WEB_CONCURRENCY'] || 3)