From cf8b376b02eea9be078462668d6f83f4229849a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 3 Feb 2021 14:35:20 +0100 Subject: [PATCH] Lazily load `set` This file seems required by `rake` by default. By lazily loading `set`, usages of `rake` that don't use this part of `rake`, don't unnecessarily activate the `set` gem. This seems really minor, I know. But when testing rubygems & bundler, it's interesting for us to be in full control of the gems that are loaded, to make sure that we don't unintentionally activate gems causing our users to be unable to select the version of those gems that they need. --- lib/rake/thread_pool.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rake/thread_pool.rb b/lib/rake/thread_pool.rb index b01a5efe0..332956670 100644 --- a/lib/rake/thread_pool.rb +++ b/lib/rake/thread_pool.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require "set" require "rake/promise" @@ -10,6 +9,7 @@ class ThreadPool # :nodoc: all # Creates a ThreadPool object. The +thread_count+ parameter is the size # of the pool. def initialize(thread_count) + require "set" @max_active_threads = [thread_count, 0].max @threads = Set.new @threads_mon = Monitor.new