lib/adhearsion/call.rb in adhearsion-2.1.2 vs lib/adhearsion/call.rb in adhearsion-2.1.3

- old
+ new

@@ -319,21 +319,13 @@ end "#<#{self.class}:#{id} #{attrs.join ', '}>" end def execute_controller(controller = nil, completion_callback = nil, &block) - raise ArgumentError if controller && block_given? - call = current_actor - controller ||= CallController.new call, &block - Thread.new do - catching_standard_errors do - begin - CallController.exec controller - ensure - completion_callback.call call if completion_callback - end - end - end.tap { |t| Adhearsion::Process.important_threads << t } + raise ArgumentError, "Cannot supply a controller and a block at the same time" if controller && block_given? + controller ||= CallController.new current_actor, &block + logger.info "Executing controller #{controller.inspect}" + controller.bg_exec completion_callback end # @private def register_controller(controller) @controllers << controller