Schedule Heroku tasks without using 2 additional dynos

Hi All,

I have a rails app hosted on Heroku which needs a regular task to run
every
30 mintues. The task takes 5 minutes to complete

Previously I was using the gem resque and resque-scheduler for this. The
problem however is that this requires 2 additional dynos, one for the
scheduler and one for the worker task to run on.

Is there any way to achieve this just by using one dyno instead of two?
Thanks in advance!

Thanks,
Ganesh

On Wed, Dec 3, 2014 at 3:24 PM, Ganesh Ranganathan <
[email protected]> wrote:

Previously I was using the gem resque and resque-scheduler for this. The
problem however is that this requires 2 additional dynos, one for the
scheduler and one for the worker task to run on.

​You could use the sucker punch gem which does the background processing
along with the rails process, so there shouldn’t be the need to start
another dyno. Not sure about if we can schedule it to start at a
particular
point of time.

Btw, just curious. Cant we write cron jobs in heroku? Using something
like
the whenever https://github.com/javan/whenever gem.

Cheers,

Harisankar P S
http://csnipp.com/coderhs

On Wed, Dec 3, 2014 at 3:34 PM, Harisankar P S [email protected] wrote:

​You could use the sucker punch gem which does the background processing
along with the rails process, so there shouldn’t be the need to start
another dyno. Not sure about if we can schedule it to start at a particular
point of time.

​Thanks…this seems to be a suitable gem for my purpose. The resque /
resque-scheduler was overkill since it was costing $70 a month just to
run
simple scheduled tasks .

Btw, just curious. Cant we write cron jobs in heroku? Using something like
the whenever https://github.com/javan/whenever gem.

​I am not sure conventional cron jobs can be made to work on heroku.
There
is no persistent file storage ​so even if the crontab file is edited, it
wont reflect on any other dyno.

Thanks,
Ganesh

On Wed, Dec 3, 2014 at 3:50 PM, Ganesh Ranganathan <
[email protected]> wrote:

​I am not sure conventional cron jobs can be made to work on heroku. There
is no persistent file storage ​so even if the crontab file is edited, it
wont reflect on any other dyno.

​Thats true, I did a google on running cron job in heroku it seems there
is
an addon called heroku scheduler[1] which would works like cron. But its
run hours would cost as as your regular dyno run hours so it wouldn’t be
a
cost efficient substitute.

​[1] ​Heroku Scheduler | Heroku Dev Center


Harisankar P S
https://twitter.com/coderhs | Csnipp.com -
http://csnipp.com/coderhs

On Wed, Dec 3, 2014 at 5:39 PM, Harisankar P S [email protected] wrote:

Thats true, I did a google on running cron job in heroku it seems there is
an addon called heroku scheduler[1] which would works like cron. But its
run hours would cost as as your regular dyno run hours so it wouldn’t be a
cost efficient substitute.

​Ya it’s wasteful to run a scheduler on it’s own dyno all the time just
to
schedule 1/2 tasks.​

The sucker punch gem seems a good idea. I’ll try it tonight…