Save 36% for Black Friday! Learn more

All threads / Background Workers with ActiveJob and Sidekiq - GoRails

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Background Workers with ActiveJob and Sidekiq - GoRails

Chris Oliver asked in General

Chris,

I have a website that has a large dataset that can be exported via csv. I followed your video on how to export a csv (solid video) and it was working great until my dataset got too big. The problem is Heroku times out because it takes too long. I'm currently trying to handle this by doing it through a background job, but I'm not exactly sure the best way to do that. I'm sure I need to do something with "send_data" and rather than having it directly send I need to have it send through a job.. but like I said I'm lost ha. Any help would be great.

Thanks in advance.

In that case, you'll typically build the CSV and then store it on S3 in a background job, and then provide the user with a link to download it. You can send them an email once it's uploaded or you can refresh the page periodically with AJAX until the download URL is saved to a record. Really sorta depends, but when things get outside that time window, you'll see lots of apps taking this approach.

Awesome. Makes sense. Thanks Chris.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 39,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.