Skip to content

Commit

Permalink
fix: correct thread-pool mutex logic which was causing a deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeen committed Mar 22, 2024
1 parent 3899855 commit 0400ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/graphiti/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def self.thread_pool_executor
return @thread_pool_executor if @thread_pool_executor

concurrency = Graphiti.config.concurrency_max_threads || 4
@thread_pool_executor_mutex.synchronize do
@thread_pool_executor ||= Concurrent::ThreadPoolExecutor.new(
@thread_pool_executor ||= @thread_pool_executor_mutex.synchronize do
Concurrent::ThreadPoolExecutor.new(
min_threads: 0,
max_threads: concurrency,
max_queue: concurrency * 4,
Expand Down

0 comments on commit 0400ab0

Please sign in to comment.