class Uc::Unicorn::Prestart
Attributes
server[R]
url[R]
worker[R]
Public Class Methods
new(server, worker, url: "/")
click to toggle source
# File lib/uc/unicorn/prestart.rb, line 10 def initialize(server, worker, url: "/") @server = server @worker = worker @url = url end
Public Instance Methods
app()
click to toggle source
# File lib/uc/unicorn/prestart.rb, line 16 def app @app ||= server.instance_variable_get("@app") end
id()
click to toggle source
# File lib/uc/unicorn/prestart.rb, line 37 def id @id ||= worker.nr + 1 end
make_prestart_request()
click to toggle source
# File lib/uc/unicorn/prestart.rb, line 24 def make_prestart_request event_stream.debug "prestarting worker #{id}" response = app.call(rack_request) body = response[2] if body.is_a? Rack::BodyProxy body.close end event_stream.debug "worker #{id} prestart successful" rescue => e event_stream.warn "prestart failed for worker #{id}, #{e.class}" end
run()
click to toggle source
# File lib/uc/unicorn/prestart.rb, line 20 def run make_prestart_request end
Private Instance Methods
rack_request()
click to toggle source
# File lib/uc/unicorn/prestart.rb, line 43 def rack_request Rack::MockRequest.env_for("http://127.0.0.1/#{url}") end