Search code examples
ruby-on-railsherokurake

Heroku scheduler is not working but running rake manually working


I have a task that takes over 45 minutes. It runs successfully with

$ heroku run rake:sales

I also doublechecked my settings in scheduler based on this question. Everything looks fine.


Solution

  • In order to prevent run-away jobs, jobs that run longer than their frequency will be terminated. For example, a job that runs every 10 minutes will be terminated after running for 10 minutes.

    What's happening is that your rake task is running for the first 10 minutes, but Heroku aborts it after that elapses. They suggest using a background job queue for long-running tasks.

    Source:

    https://devcenter.heroku.com/articles/scheduler#long-running-jobs