lib/adhearsion/process.rb in adhearsion-2.0.0.alpha1 vs lib/adhearsion/process.rb in adhearsion-2.0.0.alpha2

- old
+ new

@@ -55,11 +55,11 @@ super end def log_state_change(transition) event, from, to = transition.event, transition.from_name, transition.to_name - logger.info "Transitioning from #{from} to #{to} with #{Adhearsion.active_calls.size} active calls." + logger.info "Transitioning from #{from} to #{to} with #{Adhearsion.active_calls.size} active calls due to #{event} event." end def request_stop Events.trigger_immediately :stop_requested important_threads << Thread.new { stop_when_zero_calls } @@ -67,13 +67,16 @@ def final_shutdown Adhearsion.active_calls.each do |call| call.hangup end + # This should shut down any remaining threads. Once those threads have # stopped, important_threads will be empty and the process will exit # normally. Events.trigger_immediately :shutdown + + Console.stop end def stop_when_zero_calls until Adhearsion.active_calls.count == 0 logger.trace "Stop requested but we still have #{Adhearsion.active_calls.count} active calls."