1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Rewrite Reactor#run_in_thread

- Log both error message and backtrace to STDERR
- Reintroduce pipe closing when thread exits
This commit is contained in:
Gustav Munkby 2013-10-28 14:27:30 +01:00
parent 74ea16df7f
commit bd15892046

View file

@ -109,17 +109,18 @@ module Puma
end
def run_in_thread
@thread = Thread.new {
while true
begin
run_internal
break
rescue StandardError => e
STDERR.puts "Error in reactor loop escaped: #{e.message} (#{e.class})"
puts e.backtrace
end
@thread = Thread.new do
begin
run_internal
rescue StandardError => e
STDERR.puts "Error in reactor loop escaped: #{e.message} (#{e.class})"
STDERR.puts e.backtrace
retry
ensure
@trigger.close
@ready.close
end
}
end
end
def calculate_sleep