perf(export): fix memory leak after large files downloads

This commit is contained in:
Colin Darie 2024-04-01 19:37:23 +02:00
parent 46c5830306
commit f9af570cab

View file

@ -14,7 +14,7 @@ module DownloadManager
def download_all
hydra = Typhoeus::Hydra.new(max_concurrency: DOWNLOAD_MAX_PARALLEL)
attachments.map do |attachment, path|
attachments.each do |attachment, path|
begin
download_one(attachment: attachment,
path_in_download_dir: path,
@ -23,7 +23,10 @@ module DownloadManager
on_error.call(attachment, path, e)
end
end
hydra.run
GC.start
end
# can't be used with typhoeus, otherwise block is closed before the request is run by hydra