Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let configuration define the number of threads to upload concurrently #395

Open
oldigor opened this issue Jan 29, 2020 · 2 comments
Open

Comments

@oldigor
Copy link
Contributor

oldigor commented Jan 29, 2020

I guess it is necessary to change only this piece of code

if self.config.concurrent_uploads
        threads = ThreadGroup.new
        # Upload new files
        local_files_to_upload.each do |f|
          next unless File.file? "#{path}/#{f}" # Only files.
          threads.add(Thread.new { upload_file f })
        end
        sleep 1 while threads.list.any? # wait for threads to finish uploading

in thttps://github.com/AssetSync/asset_sync/blob/11d206f316d67df9c8076bad9f5d5b5ba7f73d4c/lib/asset_sync/storage.rb#L245

@PikachuEXE
Copy link
Member

I have no idea how to limit thread count properly
Any example code from other libraries you can find?

@RickCSong
Copy link

Created a PR to enable this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants