Method: ActiveSupport::Testing::Parallelization::Server#shutdown

Defined in:
activesupport/lib/active_support/testing/parallelization/server.rb

#shutdownObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'activesupport/lib/active_support/testing/parallelization/server.rb', line 56

def shutdown
  # Wait for initial queue to drain
  while @queue.length != 0
    sleep 0.1
  end

  @queue.close

  # Wait until all workers have finished
  while active_workers?
    sleep 0.1
  end

  @in_flight.values.each do |(klass, name, reporter)|
    result = Minitest::Result.from(klass.new(name))
    error = RuntimeError.new("result not reported")
    error.set_backtrace([""])
    result.failures << Minitest::UnexpectedError.new(error)
    reporter.synchronize do
      reporter.record(result)
    end
  end
end