Wrangling slow reports, large file exports, and long-running tasks in Rails with ActiveJob

30-Jan-2020 2324
Sometimes we need to generate really large file exports or run reports that are just slow. It’s not enough to optimize a few queries, we need to move the work to a background job and notify the user when it’s all. In every non-trivial application you’ll have to do something that is just slow. You need to export a large data set to a CSV file. An analyst needs a complicated Excel report. Or maybe you have to connect to an external API and process a whole bunch of data.So how do you know when it’s time to use background jobs?If you try building these kinds of reports in a normal Rails controller action, you will see these symptoms:.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle