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