Closed fatuhoku closed 7 years ago
Hmmm looks like you could probably just use ZipTricks directly... I haven't looked at their repository recently, but it looks like they've evolved to totally subsume the functionality of this repo (which is getting to be poorly maintained, sorry)... check out this part of their readme: https://github.com/WeTransfer/zip_tricks#diving-in-send-some-large-csv-reports-from-rails
Hey @fringd thanks for the response — I did have a go at using zip_tricks but I ended up with the same issue. The block that I thought was going to be deferred due to lazy
was being executed eagerly.
what's your code look like?
On Tue, Mar 7, 2017 at 5:13 AM Hok Shun Poon notifications@github.com wrote:
Hey @fringd https://github.com/fringd thanks for the response — I did have a go at using zip_tricks but I ended up with the same issue. The block that I thought was going to be deferred due to lazy was being executed eagerly.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/fringd/zipline/issues/29#issuecomment-284678999, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQpRQHBr5gD2gPCNCGF74cAd0XEEkWXks5rjS29gaJpZM4MUUU_ .
@fatuhoku please post some example code and we will figure out what's going on. I think your issue is rather on the output side of things than on the Zip side of things (if you are saying that StringIO's are involved)
Never mind — I've fixed the issue by using a background job + sidekiq. Cheers!
It takes about 2 seconds to generate a PDF. I want the zip download to start streaming as soon as each PDF is ready. However I did not want to store the PDFs, because they rely on live data from the database.
So, I put the PDF generation routine into a lazy array, in the hope that zipline would trigger PDF generation, and STREAM that same PDF immediately afterwards by wrapping it with a StringIO.
However, ZipTricks instead appears to want to iterate over all the files, triggering PDF rendering eagerly.
How can I ensure these PDFs get generated lazily?