I have a list of tasks that need to be performed in the background (Rails 5.0.1) in the following order-
This needs to be done everyday without any human input. Right now, I am using Rails runner to do all of that and scheduling it using cron ('Whenever' gem). So, is using 'runner' the right approach? Is there a less memory intensive approach I can use, given that the frontend (admin panel) won't be accessed much? How about active job, rake, daemons etc?
. A rake task is just a bunch of code inside a namespace that is executed via rake management tool
. runner
runs Ruby code in the context of Rails non-interactively
. Daemon on the other hand is completely different thing than this two, you can check more about it here: http://daemons.rubyforge.org/
For your case it's best to use rake because it doesn't boot rails "unless you make it" (runner have to boot rails).
Another thing is rake is single threaded, so If you want to a single task to be done efficiently you can use rake, if you have multiple tasks you can make use of workers and tools like Sidekiq, Resque and Delayed jobs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With