lib/pitchfork/http_server.rb in pitchfork-0.8.0 vs lib/pitchfork/http_server.rb in pitchfork-0.9.0
- old
+ new
@@ -72,11 +72,11 @@
self
end
end
# :stopdoc:
- attr_accessor :app, :timeout, :soft_timeout, :cleanup_timeout, :worker_processes,
+ attr_accessor :app, :timeout, :soft_timeout, :cleanup_timeout, :spawn_timeout, :worker_processes,
:after_worker_fork, :after_mold_fork,
:listener_opts, :children,
:orig_app, :config, :ready_pipe,
:default_middleware, :early_hints
attr_writer :after_worker_exit, :before_worker_exit, :after_worker_ready, :after_request_complete,
@@ -554,9 +554,13 @@
end
def spawn_worker(worker, detach:)
logger.info("worker=#{worker.nr} gen=#{worker.generation} spawning...")
+ # We set the deadline before spawning the child so that if for some
+ # reason it gets stuck before reaching the worker loop,
+ # the monitor process will kill it.
+ worker.update_deadline(@spawn_timeout)
Pitchfork.fork_sibling do
worker.pid = Process.pid
after_fork_internal
worker_loop(worker)