我正在尝试使用使特定控制器的操作获得HTTP GET的Heroku计划任务。下面是任务的样子:Heroku使用Net :: HTTP库进行HTTP GET请求的计划任务 - Ruby on Rails
require 'net/http'
desc "This task is called by the Heroku scheduler add-on"
task :send_notifications => :environment do
Net::HTTP.get("http://testapp.com", "/test/send_notifications")
end
一旦运行:
heroku rake send_notifications
我得到以下错误:
rake aborted!
getaddrinfo: Name or service not known
/app/lib/tasks/scheduler.rake:5:in `block in <top (required)>'
有什么想法?
在此先感谢
要在Heroku上运行rake我认为你应该从命令行调用'heroku run rake db:migrate'等。 –