From 221e6d93501ffaf687877e8a94066b2fc8d87a04 Mon Sep 17 00:00:00 2001 From: Nick Pezza Date: Sun, 6 Oct 2024 13:40:26 -0400 Subject: [PATCH] Add back thread observer --- lib/solid_queue/pool.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/solid_queue/pool.rb b/lib/solid_queue/pool.rb index 4641a9d4..c1bcf195 100644 --- a/lib/solid_queue/pool.rb +++ b/lib/solid_queue/pool.rb @@ -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