Skip to content

Instantly share code, notes, and snippets.

@marzdgzmn
Created December 26, 2018 15:44
Show Gist options
  • Save marzdgzmn/37ef33a17716fae30db86446b4d8b769 to your computer and use it in GitHub Desktop.
Save marzdgzmn/37ef33a17716fae30db86446b4d8b769 to your computer and use it in GitHub Desktop.
thread_pool = Concurrent::FixedThreadPool.new(10, max_queue:50)
until job_list.empty?
job = job_list.shift
Concurrent::Promises.future(executor: thread_pool) { MyJob.run(job) }.
rescue{ |e| puts e }.result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment