Heroku Job Delay

I have a Rails application hosted on Heroku that needs to import data weekly. The task is performed by administrators and takes about 1-2 minutes to run (calculation time). On Heroku, quests that take 30 seconds to complete . Heroku recommends priority work - however, paying $ 36.00 per month (price per employee) for 8 minutes of calculation time does not seem to work. A few questions:

  • Is it possible to pay only deferred tasks when they are used (i.e., the task service starts with a delay only when administrators load the data import).
  • Is delayed work required? I am not sure if the timeout is simply displayed to the client or if the actual work is canceled. The documentation has a β€œdon't take any action” list as an option, but I'm not sure what the consequences of this are.

Thank!

+3
source share
4 answers

You can check out HireFire .

HireFire "" "" ( "" ) . , HireFire () . , () . , , ( ).

+8

, (, , ).

, .

? , - . " " , , .

, , -, . cron Addon ( ). lib/tasks/cron.rake.

task :cron => :environment do
  if Time.now.strftime('%w').to_i == 0 # run every sunday
    puts "Importing..."
    #... run import
    puts "done."
  end
end

, , .

+2

, API- heroku, .

+1

After testing, it turned out that the timeout does not prevent the completion of long tasks (only the results are displayed to the user). Ended email notification and timeout permission. I looked at the thread request, but the support in Rails seems fluffy.

0
source

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


All Articles