Tweetstream rake在dev中工作,但不适用于heroku

时间:2014-07-17 04:08:33

标签: heroku ruby-on-rails-4 scheduler rakefile tweetstream

我正在运行轨道4, 红宝石2.1.1, webbrick, Heroku的, Tweetstream。

我有一个rake文件流式传输并将它们保存到数据库中,它在开发中运行良好。

当我在Heroku中运行rake文件时,它只是在进入流循环时挂起... 日志只是说“等待客户”,并挂起。

之前从未使用过调度程序或rake 我该如何调试,找出问题,看看来自twitter的回复?我应该发布哪些其他信息?什么设置可能导致此问题?

heroku日志

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"

1 个答案:

答案 0 :(得分:0)

固定!原来rake文件无法从rails外部访问该类。我在实际的rake文件中添加了一些需求和活动记录类。这在tweetstream文档中没有明确指出(仅限于守护进程)。

在开发过程中一切正常......令人困惑,因为使用tweetstream的日志和错误处理并不完整。我最终使用twitter gem进行流式传输,它确实有更好的错误处理。仍然不得不每次都要推送到heroku进行测试。

仍然想知道在生产中调试rake文件的更好方法。

如果你遇到与工人,heroku调度程序或rake类似的问题,这里有一些有用的链接。

write to database with tweetstream daemon

最重要的是 想在Rails外面的ruby脚本中使用ActiveRecord吗? How to use ActiveRecord in a ruby script outside Rails?