Skip to content

Instantly share code, notes, and snippets.

@etozzato
Created November 11, 2009 18:03
Show Gist options
  • Save etozzato/232154 to your computer and use it in GitHub Desktop.
Save etozzato/232154 to your computer and use it in GitHub Desktop.
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Mongrel: port 3000 is already in use, trying 3001
def initialize(host, port, num_processors=950, throttle=0, timeout=60)
tries = 0
while @socket.nil?
begin
@socket = TCPServer.new(host, port)
rescue Errno::EADDRINUSE
STDERR.puts "Mongrel: port #{port} is already in use, trying #{port+1}"
port = 1 + port
end
end
@classifier = URIClassifier.new
@host = host
@port = port
@workers = ThreadGroup.new
@throttle = throttle / 100.0
@num_processors = num_processors
@timeout = timeout
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment