특정 컨트롤러의 작업에 HTTP를 사용하도록하는 Heroku 예약 작업을 사용하려고합니다. 실행시Net :: HTTP 라이브러리를 사용하여 HTTP GET 요청을하는 Heroku 예약 된 작업 - 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)>'
어떤 생각을?
response = HTTParty.get('http://testapp.com/test/send_notifications')
헤로 쿠에서 레이크를 실행하려면 커맨드 라인에서 실제로 'heroku run rake db : migrate'등을 호출해야한다고 생각합니다. –