Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Rake task on Heroku time out?

I'm using Heroku and would like to have a script (on another server) called via cron that periodically requests an action on my Heroku app. This action will in turn run some processing that may take 1 or 2 minutes to complete. I believe Heroku has 30 second request limit, I was thinking could call a Rake task from my controller action instead.

Would this work? I'm curious if anyone has tried this yet.

Thanks.

like image 963
Jim Jones Avatar asked Feb 27 '23 12:02

Jim Jones


1 Answers

The rake task would work as long as you don't use a HTTP request as proxy to initiate the task. In fact, if the task is forked from a HTTP Request, the timeout will be the same of the HTTP request.

You should a different method to start the task. Either a crontab (on Heroku side) or a Worker as good solutions.

like image 151
Simone Carletti Avatar answered Mar 07 '23 23:03

Simone Carletti