diff --git a/lib/graphiti/scope.rb b/lib/graphiti/scope.rb index 8f8102ee..6c7ac272 100644 --- a/lib/graphiti/scope.rb +++ b/lib/graphiti/scope.rb @@ -3,14 +3,14 @@ class Scope attr_accessor :object, :unpaginated_object attr_reader :pagination - @thread_pool_executor_mutex = Mutex.new + @@thread_pool_executor_mutex = Mutex.new def self.thread_pool_executor return @thread_pool_executor if @thread_pool_executor concurrency = Graphiti.config.concurrency_max_threads || 4 - @thread_pool_executor ||= @thread_pool_executor_mutex.synchronize do - Concurrent::ThreadPoolExecutor.new( + @@thread_pool_executor_mutex.synchronize do + @@thread_pool_executor ||= Concurrent::ThreadPoolExecutor.new( min_threads: 0, max_threads: concurrency, max_queue: concurrency * 4,