Last active
January 20, 2020 00:36
-
-
Save pabloh/94c5dd1ead2ed8bc26dfbba600691f89 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
# Set up pool | |
SharedPool = Concurrent::ThreadPoolExecutor.new( | |
:max_threads => 50, | |
:idletime => 10.minutes | |
) | |
# Worker thread | |
results = inputs.map do |input| | |
Concurrent::Future.execute_on(SharedPool) { DB.run_some_query(input) } | |
end.map(&:value!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment