Skip to content

Commit

Permalink
Add back thread observer
Browse files Browse the repository at this point in the history
  • Loading branch information
npezza93 committed Oct 6, 2024
1 parent 01d2f80 commit 221e6d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/solid_queue/pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ def post(execution)
available_threads.decrement

future = Concurrent::Future.new(args: [ execution ], executor: executor) do |thread_execution|
begin
wrap_in_app_executor do
thread_execution.perform
end
rescue Exception
nil
wrap_in_app_executor do
thread_execution.perform
ensure
available_threads.increment
mutex.synchronize { on_idle.try(:call) if idle? }
end
end

future.add_observer do |_, _, error|
handle_thread_error(error) if error
end

future.execute
end

Expand Down

0 comments on commit 221e6d9

Please sign in to comment.