Reputation: 1
I'm trying to generate pdf in Heroku but sometimes it takes more than 30 secs and Heroku returns timeout error.
def index
respond_to do |format|
format.html
format.pdf
end
end
My question is how can i make it delayed job. I installed delayed jobs gem but i couldn't figure out to put action into queue.
Upvotes: 0
Views: 366
Reputation: 42865
Delayed job is a little complicated to get setup. Try spawn It's seriously easy to get going. If it doesn't work then I will show you have to use delayed job.
Install spawn as a plugin:
rails plugin install https://github.com/tra/spawn.git
Or if you are on Rails 2
script/plugin install https://github.com/tra/spawn.git
Then all you need to do is add a method to your controller:
def index
spawn_do
#some code here that processes your pdf
end
respond_to do |format|
format.html
format.pdf
end
end
Upvotes: 1