0

I have a list of tasks in my ruby on rails app which are called by a scheduler. In short, I use a scheduler to call rake perform_hourly once every hour.

task :perform_hourly => :environment do

  require 'platform-api'
  heroku = PlatformAPI.connect_oauth('<my api key>') 

      heroku.dyno.create('myapp', {
        :command => "rake fetch_products",
        :attach => false
      })  
end

task :fetch_products => :environment do
// Do product fetching stuff
end

Will this cause two instances of the app to be loaded into memory? One for perform_hourly and one for fetch_products? Thus, making my app use 3x the amount of avg instance memory during the running of these tasks?

It doesn't look like it, according to what I can see on New Relic but, on the other hand, I am trouble shooting many different issues at the same time and I want to rule this one out.

Christoffer
  • 2,271
  • 3
  • 26
  • 57
  • 1
    It's not just "rake task calls rake task". You do explicitly create a new dyno (as far as I can tell). – Sergio Tulentsev Jan 12 '18 at 16:47
  • yeah, take a look at [how-do-i-run-rake-tasks-within-a-ruby-script](https://stackoverflow.com/questions/3530/how-do-i-run-rake-tasks-within-a-ruby-script) there's no reason it should take more memory than any other method call, of course taking into consideration how performance-intensive the second rake task is – max pleaner Jan 12 '18 at 17:39
  • Sergio: Yeah, that is correct. To be honest, I created this task quite a while ago and can't really remember why I chose this solution. I will try scheduling calls for a function instead. – Christoffer Jan 14 '18 at 23:41

0 Answers0