用时钟处理运行Rake任务

时间:2013-07-16 03:42:13

标签: ruby-on-rails heroku scheduled-tasks clockwork

在我的Heroku应用程序中,我有一个时钟进程需要定期执行rake任务。我正在使用clockwork gem.Here是lib / clock.rb中的代码:

require File.expand_path('../../config/boot',        __FILE__)
require File.expand_path('../../config/environment', __FILE__)
require 'clockwork'

include Clockwork

every(1.day, 'API Data Fetching', :at => '18:31') { `rake build_index` }

这是Heroku日志片段:

2013-07-15T18:31:00.716092+00:00 app[clock.1]: I, [2013-07-15T18:31:00.673880 #2]  INFO -- : Triggering 'API Data Fetching'
2013-07-15T18:31:39.131681+00:00 app[clock.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
2013-07-15T18:31:39.132841+00:00 app[clock.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
2013-07-15T18:31:39.132346+00:00 app[clock.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)

未执行任务且未提取任何API数据。可能是什么问题?从clock.rb运行一个rake任务坏主意?

1 个答案:

答案 0 :(得分:0)

很长一段时间后回答:)但是你需要将proc文件添加到使用heroku this question的工作clockworker gem中可能会对你有所帮助。