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.

Reply

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.

Reply
Join the discussion
Create an account Log in

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

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

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