Im running rails 4, ruby 2.1.1, webbrick, heroku, Tweetstream.
I have a rake file that streams Tweets and saves them to the database, it works fine in development.
When I run the rake file in Heroku, it just hangs when it gets to the stream loop... the logs just say "Awaiting client", and hangs.
never used scheduler or rake before.
How can I debug this, figure out problem, see response from twitter? What additional information should I be posting? What settings could be causing this problem?
heroku logs
014-07-17T05:08:26.334130+00:00 heroku[api]: Starting process with command `bundle exec rake tweet_stream` by user@email.com
2014-07-17T05:08:30.027406+00:00 heroku[run.5680]: State changed from starting to up
2014-07-17T05:08:29.884399+00:00 heroku[run.5680]: Starting process with command `bundle exec rake tweet_stream`
2014-07-17T05:08:29.842136+00:00 heroku[run.5680]: Awaiting client
gemfile
source 'https://rubygems.org'
gem 'pry'
gem 'tweetstream'
gem 'rickshaw_rails'
gem 'twitter'
gem 'figaro'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
gem 'rails_12factor', group: :production
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
ruby "2.1.0"
Fixed! Turns out the rake file could not access the class from outside of rails. I added some requires and the active record class into the actual rake file. This is not clearly pointed to in the tweetstream docs, (only on daemonization).
In development everything worked fine... confusing because the logs and error handling with tweetstream were not complete. I ended up streaming with the twitter gem which did have better error handling. Still had to push to heroku everytime to test.
Still would like to know a better way to debug a rake file in production.
If your having a similar problem with workers, heroku scheduler, or rake, here are some of the links that helped.
write to database with tweetstream daemon
most important ow to use ActiveRecord in a ruby script outside Rails? How to use ActiveRecord in a ruby script outside Rails?