-
-
Save wkonkel/ce246e1a9a6e101afa0f75a6ef761829 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@queue = Queue.new | |
@queue.push(url: '/foo') | |
workers = (0...CONCURRENCY).map do | |
Thread.new do | |
while options = @queue.pop | |
begin | |
make_request(options) | |
rescue => e | |
retry_request(options) | |
end | |
@queue.close if @queue.num_waiting == CONCURRENCY - 1 | |
end | |
end | |
end | |
workers.each(&:join) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment