Can the missile task to Herek time out?

I am using Heroku and would like to have a script (on another server) called via cron that periodically requests an action in my Heroku application. This action, in turn, will lead to some processing, which can take 1 or 2 minutes. I believe Heroku has a 30 second request limit, I thought you could instead invoke the Rake task from my action with the controller.

Will this work? I'm curious if anyone else has tried this.

Thanks.

+4
source share
3 answers

I would recommend using a background job for the worker for this work. Then your batch process should have started the worker, no matter how long the process has gone.

+2
source

The rake task will work until you use the HTTP request as a proxy server to run the task. In fact, if the task forks out from the HTTP request, the timeout will be the same from the HTTP request.

You need a different method to run the task. Either crontab (on Heroku's side) or Worker as good solutions.

+4
source

I just created a pearl to solve this particular problem. This allows you to queue any rake task as a delayed_job, for example.

rake delay:db:seed 

which will execute

 rake db:seed 

like delayed_job. You can find it at http://rubygems.org/gems/delayed_task or http://blog.opsb.co.uk/long-running-rake-tasks-on-heroku .

+2
source

Source: https://habr.com/ru/post/1302027/


All Articles