Search code examples
ruby-on-railsrubyherokuscheduled-taskssidekiq

How to schedule PhantomJS scraped on free Heroku dynos?


I'm under the impression that free dynos will spin down after a while.

What happens to a script that's running currently with my main ruby server / fires off PhantomJS sraper every now and again?

Do I need a dedicated worker process for this or will Heroku Scheduler do just fine alongside a paid dyno?

I've no issues paying for it, the development always takes a hot second and their workers are a little pricey.

Thanks in advance.


Solution

  • If you want to periodically run a script, Heroku Scheduler is really the ideal way to do this. It'll use one-off dynos, which DO count towards your free dyno allocation each month, but only run during the duration of the task, and stop afterwards.

    This is much cheaper, for instance, than running a dedicated worker dyno that is up 24x7, vs a one-off dyno (powered by Heroku Scheduler) which only runs for a few minutes per day.