Created
September 22, 2009 18:39
-
-
Save defunkt/191309 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after_fork do |server, worker| | |
## | |
# Set the listening HTTP port for each of the workers dynamically | |
port = 5000 + worker.nr | |
begin | |
server.listen("127.0.0.1:#{port}") | |
rescue Errno::EADDRINUSE | |
# we couldn't grab the port we want so just keep | |
# trying until someone kills us | |
sleep 3 | |
retry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment