From e27ce40e1b291a6fe4309473a7a96024d6f24b02 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Mon, 18 Jul 2022 11:29:14 -0700 Subject: [PATCH] Avoid creating an unnecessary thread pool If the thread_pool does not already exist, there is no point in creating a thread pool just to join the threads in it. This is an alternative fix for #440. --- lib/rake/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 02586ad5e..d4e2680f6 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -124,7 +124,7 @@ def run_with_threads yield - thread_pool.join + thread_pool.join if defined?(@thread_pool) if options.job_stats stats = thread_pool.statistics puts "Maximum active threads: #{stats[:max_active_threads]} + main"